rbbt-sources 3.0.33 → 3.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/sources/go.rb +26 -16
- data/share/install/Organism/organism_helpers.rb +10 -0
- data/test/rbbt/sources/test_go.rb +12 -32
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70e1df68dd361e27ccf4fa97f3d1566843aa9782
|
4
|
+
data.tar.gz: 700991e8dbbd83e10c956960d530692da3feff7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f3eae3226db83878bb5fd5b58f7562ab38f3a7f36fbc4dc94752e4df0793834d9d2f451dcd0557275332e7ae81c2ec6ef10fde1f139f4eae089b8887bcb998d
|
7
|
+
data.tar.gz: 0c3e5d7294eaf73ce9c192dfa3073921ab5961936f87eb1578dc38b94b43147d559475f019a3c9294314fa603bd754dcba82db4040cd1f46180f0b5edf648df6
|
data/lib/rbbt/sources/go.rb
CHANGED
@@ -57,23 +57,32 @@ module GO
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def self.
|
60
|
+
def self.id2ancestors_by_type(id, type='is_a')
|
61
61
|
if id.kind_of? Array
|
62
62
|
info.values_at(*id).
|
63
|
-
select{|i| ! i[
|
64
|
-
collect{|i|
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
select{|i| ! i[type].nil?}.
|
64
|
+
collect{|i|
|
65
|
+
res = i[type]
|
66
|
+
res = [res] unless Array === res
|
67
|
+
res.collect{|id|
|
68
|
+
id.match(/(GO:\d+)/)[1] if id.match(/(GO:\d+)/)
|
69
|
+
}.compact
|
70
|
+
}
|
68
71
|
else
|
69
|
-
return [] if id.nil? or info[id].nil? or info[id][
|
70
|
-
info[id][
|
72
|
+
return [] if id.nil? or info[id].nil? or info[id][type].nil?
|
73
|
+
res = info[id][type]
|
74
|
+
res = [res] unless Array === res
|
75
|
+
res.
|
71
76
|
collect{|id|
|
72
77
|
id.match(/(GO:\d+)/)[1] if id.match(/(GO:\d+)/)
|
73
78
|
}.compact
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
82
|
+
def self.id2ancestors(id)
|
83
|
+
id2ancestors_by_type(id, 'is_a') + id2ancestors_by_type(id, 'relationship')
|
84
|
+
end
|
85
|
+
|
77
86
|
def self.id2namespace(id)
|
78
87
|
self.init unless info
|
79
88
|
if id.kind_of? Array
|
@@ -89,10 +98,10 @@ module GO
|
|
89
98
|
return ancestors if FalseClass === valid
|
90
99
|
valid_ancestors = ancestors & valid
|
91
100
|
return valid_ancestors if valid_ancestors.any?
|
92
|
-
|
101
|
+
ancestors.inject([]) do |acc,ancestor|
|
93
102
|
valid_a = ancestors_in ancestor, valid
|
94
103
|
acc = acc + valid_a
|
95
|
-
end
|
104
|
+
end.uniq
|
96
105
|
end
|
97
106
|
|
98
107
|
def self.group_genes(list, valid = nil)
|
@@ -100,10 +109,12 @@ module GO
|
|
100
109
|
|
101
110
|
compartment_leaves = {}
|
102
111
|
list.zip(list.go_cc_terms).each do |gene,terms|
|
112
|
+
terms = [] if terms.nil?
|
113
|
+
valid_terms = terms & valid
|
103
114
|
valid_terms = terms.collect{|term|
|
104
115
|
(valid.include?(term) ? term : ancestors_in(term, valid))
|
105
116
|
}.flatten
|
106
|
-
valid_terms - GOTerm.setup(valid_terms).flat_ancestry.flatten
|
117
|
+
#valid_terms - GOTerm.setup(valid_terms).flat_ancestry.flatten
|
107
118
|
valid_terms.each do |term|
|
108
119
|
compartment_leaves[term] ||= []
|
109
120
|
compartment_leaves[term].push(gene)
|
@@ -112,7 +123,6 @@ module GO
|
|
112
123
|
|
113
124
|
groups = {}
|
114
125
|
while compartment_leaves.length > 1
|
115
|
-
|
116
126
|
# Group common
|
117
127
|
group = false
|
118
128
|
new_compartment_leaves = {}
|
@@ -131,6 +141,7 @@ module GO
|
|
131
141
|
if group == false
|
132
142
|
new_compartment_leaves = {}
|
133
143
|
final = compartment_leaves.keys
|
144
|
+
compartment_leaves
|
134
145
|
compartment_leaves.each do |c,l|
|
135
146
|
final = final - GOTerm.setup(c.dup).flat_ancestry
|
136
147
|
end
|
@@ -139,10 +150,9 @@ module GO
|
|
139
150
|
if final.include? c
|
140
151
|
valid_an = ancestors_in c, valid
|
141
152
|
valid_an.each do |ancestor|
|
142
|
-
ancestor = valid.first
|
143
|
-
next if ancestor.nil?
|
144
153
|
new_compartment_leaves[ancestor] ||= []
|
145
|
-
new_compartment_leaves[ancestor].
|
154
|
+
new_compartment_leaves[ancestor].push(c)
|
155
|
+
groups[ancestor].push(c) if groups[ancestor]
|
146
156
|
end
|
147
157
|
else
|
148
158
|
new_compartment_leaves[c] = l
|
@@ -153,7 +163,7 @@ module GO
|
|
153
163
|
end
|
154
164
|
ng = {}
|
155
165
|
groups.keys.reverse.each do |k|
|
156
|
-
ng[k] = {items: groups[k], id: k, name: id2name(k)}
|
166
|
+
ng[k] = {items: groups[k].uniq, id: k, name: id2name(k)}
|
157
167
|
end
|
158
168
|
ng
|
159
169
|
end
|
@@ -44,6 +44,10 @@ $biomart_transcript_5utr = [
|
|
44
44
|
["5' UTR", '5utr'],
|
45
45
|
]
|
46
46
|
|
47
|
+
$biomart_transcript_biotype = [
|
48
|
+
["Ensembl Transcript Biotype", 'transcript_biotype'],
|
49
|
+
]
|
50
|
+
|
47
51
|
|
48
52
|
$biomart_protein_sequence = [
|
49
53
|
['Protein Sequence','peptide'],
|
@@ -432,6 +436,12 @@ file 'gene_biotype' do |t|
|
|
432
436
|
Misc.sensiblewrite(t.name, biotype.to_s)
|
433
437
|
end
|
434
438
|
|
439
|
+
file 'transcript_biotype' do |t|
|
440
|
+
biotype = BioMart.tsv($biomart_db, $biomart_ensembl_transcript, $biomart_transcript_biotype, [], nil, :type => :single, :namespace => Thread.current['namespace'])
|
441
|
+
|
442
|
+
Misc.sensiblewrite(t.name, biotype.to_s)
|
443
|
+
end
|
444
|
+
|
435
445
|
file 'gene_pfam' do |t|
|
436
446
|
pfam = BioMart.tsv($biomart_db, $biomart_ensembl_gene, $biomart_pfam, [], nil, :type => :double, :namespace => Thread.current['namespace'])
|
437
447
|
|
@@ -9,65 +9,45 @@ require 'test/unit'
|
|
9
9
|
|
10
10
|
|
11
11
|
class TestGo < Test::Unit::TestCase
|
12
|
-
def
|
12
|
+
def test_go
|
13
13
|
assert_match('vacuole inheritance',GO::id2name('GO:0000011'))
|
14
14
|
assert_equal(['vacuole inheritance','alpha-glucoside transport'], GO::id2name(['GO:0000011','GO:0000017']))
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def test_ancestors
|
18
18
|
assert GO.id2ancestors('GO:0000001').include? 'GO:0048308'
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def test_namespace
|
22
22
|
assert_equal 'biological_process', GO.id2namespace('GO:0000001')
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def test_ancestors
|
26
26
|
term = GOTerm.setup("GO:0005634")
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def test_ancestry
|
30
30
|
term = GOTerm.setup("GO:0005634")
|
31
31
|
term.ancestry.include? "GO:0005634"
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
term = GOTerm.setup("GO:
|
34
|
+
def test_ancestors_in
|
35
|
+
term = GOTerm.setup("GO:0005730")
|
36
36
|
valid = %w(GO:0005886 GO:0005634 GO:0005730 GO:0005829)
|
37
|
+
iii term.name
|
37
38
|
iii GO.ancestors_in(term, valid)
|
38
39
|
end
|
39
40
|
|
40
41
|
def test_groups
|
41
|
-
list = Gene.setup(%w(
|
42
|
-
|
43
|
-
ENSG00000038427
|
44
|
-
ENSG00000047457
|
45
|
-
ENSG00000058668
|
46
|
-
ENSG00000065361
|
47
|
-
ENSG00000070778
|
48
|
-
ENSG00000072364
|
49
|
-
ENSG00000073711
|
50
|
-
ENSG00000075420
|
51
|
-
ENSG00000088387
|
52
|
-
ENSG00000096384
|
53
|
-
ENSG00000100345
|
54
|
-
ENSG00000102804
|
55
|
-
ENSG00000102910
|
56
|
-
ENSG00000103657
|
57
|
-
ENSG00000104043
|
58
|
-
ENSG00000106772
|
59
|
-
ENSG00000107186
|
60
|
-
ENSG00000108262
|
61
|
-
ENSG00000261163
|
62
|
-
ENSG00000263077
|
63
|
-
ENSG00000101654
|
64
|
-
ENSG00000111012), :organism => Organism.default_code("Hsa"))
|
42
|
+
list = Gene.setup(%w(FBXW7 SP140 LHX2 KIF23),
|
43
|
+
"Associated Gene Name", Organism.default_code("Hsa"))
|
65
44
|
|
66
45
|
valid = %w(GO:0005886 GO:0005634 GO:0005730 GO:0005829 )
|
46
|
+
valid = %w(GO:0005634 GO:0005730)
|
67
47
|
iii GO.group_genes(list, valid)
|
68
48
|
end
|
69
49
|
|
70
|
-
def
|
50
|
+
def test_nucleolus
|
71
51
|
nuo = "GO:0005730"
|
72
52
|
nu = "GO:0005634"
|
73
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-sources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbbt-util
|