rbbt-sources 3.0.34 → 3.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/sources/biomart.rb +19 -19
- data/lib/rbbt/sources/organism.rb +4 -2
- data/test/rbbt/sources/test_organism.rb +12 -12
- 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: 083db9d4de7fef1d0b47db55ebb186dd64f1415e
|
4
|
+
data.tar.gz: b54b80b4efa6d2b58a67b2545b3f7747c11b224f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e88c53567e931644df016f4fed03154cb057ecc422df4f0105c4748a36e91e9c46798ceab150511abb43d8df6a12ff36fa6de5f199070bd435d8ce1df6d7279
|
7
|
+
data.tar.gz: 2323da3182c3c50048dbb471f3bec1e3d3ebf2860de22dda0a1fc13088a52e8f22e89174b96c3a88a89aa9653990bdbd533931bb3e0b834031eabe5eadfa1ce5
|
data/lib/rbbt/sources/biomart.rb
CHANGED
@@ -190,27 +190,27 @@ module BioMart
|
|
190
190
|
def self.tsv(database, main, attrs = nil, filters = nil, data = nil, open_options = {})
|
191
191
|
attrs ||= []
|
192
192
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
end
|
205
|
-
attrs = attrs.uniq.reject{|attr| missing.include? attr[1]}
|
206
|
-
changes = {}
|
207
|
-
missing.select{|m| m.include? "~" }.each do |str|
|
208
|
-
orig,_sep, new = str.partition "~"
|
209
|
-
changes[orig] = new
|
193
|
+
current_archive = Thread.current['archive']
|
194
|
+
missing = MISSING_IN_ARCHIVE['all'] || []
|
195
|
+
missing += MISSING_IN_ARCHIVE[current_archive] || [] if current_archive
|
196
|
+
|
197
|
+
MISSING_IN_ARCHIVE.each do |k,v|
|
198
|
+
if k =~ /^<(.*)/
|
199
|
+
t = $1.strip
|
200
|
+
missing+=v if Organism.compare_archives(current_archive, t) == -1
|
201
|
+
elsif k=~ /^>(.*)/
|
202
|
+
t = $1.strip
|
203
|
+
missing+=v if Organism.compare_archives(current_archive, t) == 1
|
210
204
|
end
|
211
|
-
attrs = attrs.collect{|n,k| [n, changes[k] || k] }
|
212
|
-
attrs
|
213
205
|
end
|
206
|
+
attrs = attrs.uniq.reject{|attr| missing.include? attr[1]}
|
207
|
+
changes = {}
|
208
|
+
missing.select{|m| m.include? "~" }.each do |str|
|
209
|
+
orig,_sep, new = str.partition "~"
|
210
|
+
changes[orig] = new
|
211
|
+
end
|
212
|
+
attrs = attrs.collect{|n,k| [n, changes[k] || k] }
|
213
|
+
attrs
|
214
214
|
|
215
215
|
|
216
216
|
codes = attrs.collect{|attr| attr[1]}
|
@@ -9,9 +9,11 @@ module Organism
|
|
9
9
|
ARCHIVE_MONTH_INDEX = {}
|
10
10
|
%w(jan feb mar apr may jun jul aug sep oct nov dec).each_with_index{|d,i| ARCHIVE_MONTH_INDEX[d] = i }
|
11
11
|
def self.compare_archives(a1, a2)
|
12
|
+
a1 = a1.partition("/").last if a1 and a1.include? "/"
|
13
|
+
a2 = a2.partition("/").last if a2 and a2.include? "/"
|
12
14
|
return 0 if a1 == a2
|
13
|
-
return -1 if a1
|
14
|
-
return 1 if
|
15
|
+
return -1 if a1 and a2.nil?
|
16
|
+
return 1 if a1.nil? and a2
|
15
17
|
|
16
18
|
m1,y1 = a1.match(/(...)(\d+)/).values_at 1, 2
|
17
19
|
m2,y2 = a2.match(/(...)(\d+)/).values_at 1, 2
|
@@ -5,37 +5,37 @@ require 'rbbt/sources/ensembl_ftp'
|
|
5
5
|
|
6
6
|
class TestOrganism < Test::Unit::TestCase
|
7
7
|
|
8
|
-
def
|
8
|
+
def test_known_ids
|
9
9
|
assert Organism.known_ids("Hsa").include?("Associated Gene Name")
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def test_location
|
13
13
|
assert_equal "share/organisms/Sce/identifiers", Organism.identifiers('Sce')
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def test_identifiers
|
17
17
|
assert Organism.identifiers('Hsa').tsv(:key_field => "Entrez Gene ID", :persist => true)['1020']["Associated Gene Name"].include?('CDK5')
|
18
18
|
assert Organism.identifiers('Sce').tsv(:persist => true)['S000006120']["Ensembl Gene ID"].include?('YPL199C')
|
19
19
|
assert Organism.identifiers("Sce").tsv(:persist => true)['S000006120']["Ensembl Gene ID"].include?('YPL199C')
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def test_lexicon
|
23
23
|
assert TSV.open(Organism.lexicon('Sce'))['S000006120'].flatten.include?('YPL199C')
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def test_guess_id
|
27
27
|
ensembl = %w(YOL044W YDR289C YAL034C YGR246C ARS519 tH(GUG)E2 YDR218C YLR002C YGL224C)
|
28
28
|
gene_name = %w(SNR64 MIP1 MRPS18 TFB2 JEN1 IVY1 TRS33 GAS3)
|
29
29
|
assert_equal "Associated Gene Name", Organism.guess_id("Sce", gene_name).first
|
30
30
|
assert_equal "Ensembl Gene ID", Organism.guess_id("Sce", ensembl).first
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def test_organisms
|
34
34
|
assert Organism.organisms.include? "Hsa"
|
35
35
|
assert_equal "Hsa", Organism.organism("Homo sapiens")
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def test_attach_translations
|
39
39
|
tsv = TSV.setup({"1020" => []}, :type => :list)
|
40
40
|
tsv.key_field = "Entrez Gene ID"
|
41
41
|
tsv.fields = []
|
@@ -47,7 +47,7 @@ class TestOrganism < Test::Unit::TestCase
|
|
47
47
|
assert_equal "CDK5", tsv["1020"]["Associated Gene Name"]
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def test_entrez_taxids
|
51
51
|
assert_equal "Hsa", Organism.entrez_taxid_organism('9606')
|
52
52
|
end
|
53
53
|
|
@@ -61,22 +61,22 @@ class TestOrganism < Test::Unit::TestCase
|
|
61
61
|
assert_equal mutation_19, Organism.liftOver([mutation_18], target_build, source_build).first
|
62
62
|
end
|
63
63
|
|
64
|
-
def
|
64
|
+
def test_orhtolog
|
65
65
|
require 'rbbt/entity/gene'
|
66
66
|
assert_equal ["ENSG00000133703"], Gene.setup("Kras", "Associated Gene Name", "Mmu/jun2011").ensembl.ortholog(Organism.default_code("Hsa"))
|
67
67
|
end
|
68
68
|
|
69
|
-
#def
|
69
|
+
#def test_genes_at_chromosome
|
70
70
|
# pos = [12, 117799500]
|
71
71
|
# assert_equal "ENSG00000089250", Organism::Hsa.genes_at_chromosome_positions(pos.first, pos.last)
|
72
72
|
#end
|
73
73
|
|
74
|
-
#def
|
74
|
+
#def test_genes_at_chromosome_array
|
75
75
|
# pos = [12, [117799500, 106903900]]
|
76
76
|
# assert_equal ["ENSG00000089250", "ENSG00000013503"], Organism::Hsa.genes_at_chromosome_positions(pos.first, pos.last)
|
77
77
|
#end
|
78
78
|
|
79
|
-
#def
|
79
|
+
#def test_genes_at_genomic_positions
|
80
80
|
# pos = [[12, 117799500], [12, 106903900], [1, 115259500]]
|
81
81
|
# assert_equal ["ENSG00000089250", "ENSG00000013503", "ENSG00000213281"], Organism::Hsa.genes_at_genomic_positions(pos)
|
82
82
|
#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.35
|
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-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbbt-util
|