rbbt-util 5.40.5 → 5.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/persist.rb +2 -2
- data/lib/rbbt/util/misc/omics.rb +9 -1
- data/lib/rbbt/workflow/doc.rb +1 -1
- data/lib/rbbt/workflow/step/accessor.rb +4 -0
- data/python/{rbbt.py → rbbt/__init__.py} +32 -3
- data/share/workflow_config.ru +11 -1
- data/test/rbbt/util/misc/test_omics.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f8c020988e2d5df3aa710ce88fe4d92a2a754363d924a580fcc31b138330258
|
4
|
+
data.tar.gz: b6ee155b7bfb819baa21fac27c8561a3e1332bd9677a081abbe811bbb45c7973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16d876542942fd0a0e1982dee1e7bf94ccd7bf8c8f4e3bb5310588a2f4587a3abe6d56fb101e1e1352c12225de507d46c18fa6b9109b2328079a999142479fa9
|
7
|
+
data.tar.gz: 6d135e37aa6151b68552a5c9f32f3cc1f1fef20a3f26695c9a033a09e0541a31a60de9b2fac33aea4c69e89a1acff54296264ba8435e9fecdaed5dcd5ee868fb
|
data/lib/rbbt/persist.rb
CHANGED
@@ -412,9 +412,9 @@ module Persist
|
|
412
412
|
repo.delete path if persist_options[:update]
|
413
413
|
repo[path] ||= yield
|
414
414
|
|
415
|
-
when (type.to_sym == :annotations and persist_options.include?
|
415
|
+
when (type.to_sym == :annotations and (persist_options.include?(:annotation_repo) || persist_options.include?(:repo)))
|
416
416
|
|
417
|
-
repo = persist_options[:annotation_repo]
|
417
|
+
repo = persist_options[:annotation_repo] || persist_options[:repo]
|
418
418
|
|
419
419
|
keys = nil
|
420
420
|
subkey = name + ":"
|
data/lib/rbbt/util/misc/omics.rb
CHANGED
@@ -251,12 +251,20 @@ module Misc
|
|
251
251
|
end
|
252
252
|
|
253
253
|
def self.translate_prot_mutation_hgvs2rbbt(mutation)
|
254
|
+
mutation.sub!('p.', '')
|
255
|
+
if m = mutation.match(/([a-z]{3})(\d+)([a-z]{3})/i)
|
256
|
+
ref = m[1]
|
257
|
+
num = m[2]
|
258
|
+
alt = m[3]
|
259
|
+
ref = THREE_TO_ONE_AA_CODE[ref.downcase]
|
260
|
+
alt = THREE_TO_ONE_AA_CODE[alt.downcase]
|
261
|
+
mutation = [ref, num, alt] * ""
|
262
|
+
end
|
254
263
|
one_aa_code = THREE_TO_ONE_AA_CODE.values
|
255
264
|
one_aa_code << "X" << "B" << "Z" << "J" << "*" << "?"
|
256
265
|
one_aa_code_re = one_aa_code*""
|
257
266
|
subs = Regexp.new("^[#{one_aa_code_re}]\\d+[#{one_aa_code_re}]")
|
258
267
|
f_aa = Regexp.new("^[#{one_aa_code_re}]\\d+")
|
259
|
-
mutation.sub!('p.', '')
|
260
268
|
mutation = case
|
261
269
|
when mutation =~ subs
|
262
270
|
mutation
|
data/lib/rbbt/workflow/doc.rb
CHANGED
@@ -30,7 +30,7 @@ module Workflow
|
|
30
30
|
title = doc_parse_first_line doc
|
31
31
|
description, task_info = doc_parse_up_to doc, /^# Tasks/i
|
32
32
|
task_description, tasks = doc_parse_up_to task_info, /^##/, true
|
33
|
-
tasks = doc_parse_chunks tasks,
|
33
|
+
tasks = doc_parse_chunks tasks, /^## (.*)/
|
34
34
|
{:title => title.strip, :description => description.strip, :task_description => task_description.strip, :tasks => tasks}
|
35
35
|
end
|
36
36
|
|
@@ -1,24 +1,53 @@
|
|
1
1
|
import warnings
|
2
2
|
import sys
|
3
3
|
import os
|
4
|
+
import subprocess
|
4
5
|
|
5
|
-
def rbbt():
|
6
|
-
|
6
|
+
def rbbt(cmd = None):
|
7
|
+
if cmd is None:
|
8
|
+
print("Rbbt")
|
9
|
+
else:
|
10
|
+
return subprocess.run('rbbt_exec.rb', input=cmd.encode('utf-8'), capture_output=True).stdout.decode()
|
11
|
+
|
12
|
+
def libdir():
|
13
|
+
return rbbt('puts Rbbt.find(:lib)').rstrip()
|
14
|
+
|
15
|
+
def add_libdir():
|
16
|
+
pythondir = os.path.join(libdir(), 'python')
|
17
|
+
sys.path.insert(0, pythondir)
|
7
18
|
|
8
19
|
def path(subdir = None, base_dir = None):
|
9
20
|
from pathlib import Path
|
10
21
|
import os
|
11
22
|
|
12
|
-
if (base_dir ==
|
23
|
+
if (base_dir == 'base'):
|
13
24
|
base_dir = os.path.join(Path.home(), ".rbbt")
|
25
|
+
elif (base_dir == 'lib'):
|
26
|
+
base_dir = libdir()
|
27
|
+
else:
|
28
|
+
for base_dir in ('lib', 'base'):
|
29
|
+
file = path(subdir, base_dir)
|
30
|
+
if os.path.exists(file):
|
31
|
+
return file
|
32
|
+
return path(subdir, 'base')
|
33
|
+
|
14
34
|
if (subdir == None):
|
15
35
|
return base_dir
|
16
36
|
else:
|
17
37
|
return os.path.join(base_dir, subdir)
|
18
38
|
|
39
|
+
def read(subdir, base_dir = None, encoding='utf-8'):
|
40
|
+
file = path(subdir, base_dir)
|
41
|
+
with open(file, encoding=encoding) as f:
|
42
|
+
return f.read()
|
43
|
+
|
19
44
|
def inspect(obj):
|
20
45
|
print(dir(obj))
|
21
46
|
|
47
|
+
def rich(obj):
|
48
|
+
import rich
|
49
|
+
rich.inspect(obj)
|
50
|
+
|
22
51
|
def log_tsv(tsv):
|
23
52
|
print(tsv)
|
24
53
|
print(tsv.keys())
|
data/share/workflow_config.ru
CHANGED
@@ -46,6 +46,7 @@ app.get '/' do
|
|
46
46
|
begin
|
47
47
|
template_render('main', params, 'main', :cache_type => :asynchronous)
|
48
48
|
rescue TemplateMissing
|
49
|
+
Log.exception $!
|
49
50
|
redirect to(File.join('/', wf.to_s))
|
50
51
|
end
|
51
52
|
end
|
@@ -88,7 +89,16 @@ load_file Rbbt.etc['app.d/semaphores.rb'].find_all
|
|
88
89
|
if etc_dir['target_workflow_exports'].exists?
|
89
90
|
exports = etc_dir['target_workflow_exports'].read.split("\n")
|
90
91
|
exports.each do |task|
|
91
|
-
|
92
|
+
if task.include?('#')
|
93
|
+
wf_name, task_name = task.split("#")
|
94
|
+
begin
|
95
|
+
task_wf = Kernel.const_get wf_name
|
96
|
+
task_wf.export task_name.to_sym
|
97
|
+
rescue
|
98
|
+
end
|
99
|
+
else
|
100
|
+
wf.export task.to_sym
|
101
|
+
end
|
92
102
|
end
|
93
103
|
end
|
94
104
|
|
@@ -35,6 +35,7 @@ class TestMiscOmics < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_translate_prot_mutation_hgvs2rbbt
|
38
|
+
assert_equal Misc.translate_prot_mutation_hgvs2rbbt("p.Arg2459Gly"), "R2459G"
|
38
39
|
assert_equal Misc.translate_prot_mutation_hgvs2rbbt("p.E255K"), "E255K"
|
39
40
|
assert_equal Misc.translate_prot_mutation_hgvs2rbbt("p.E279Z"), "E279Z"
|
40
41
|
assert_equal Misc.translate_prot_mutation_hgvs2rbbt("p.R132?"), "R132?"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.41.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -338,7 +338,7 @@ files:
|
|
338
338
|
- lib/rbbt/workflow/util/orchestrator.rb
|
339
339
|
- lib/rbbt/workflow/util/provenance.rb
|
340
340
|
- lib/rbbt/workflow/util/trace.rb
|
341
|
-
- python/rbbt.py
|
341
|
+
- python/rbbt/__init__.py
|
342
342
|
- share/Rlib/plot.R
|
343
343
|
- share/Rlib/svg.R
|
344
344
|
- share/Rlib/util.R
|