rbbt-sources 2.0.0 → 2.0.1

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.
@@ -7,16 +7,16 @@ module InterPro
7
7
  extend Resource
8
8
  self.subdir = "share/databases/InterPro"
9
9
 
10
- InterPro.claim InterPro.source.protein2ipr.find, :url, "ftp://ftp.ebi.ac.uk/pub/databases/interpro/protein2ipr.dat.gz"
10
+ InterPro.claim InterPro.source.protein2ipr, :url, "ftp://ftp.ebi.ac.uk/pub/databases/interpro/protein2ipr.dat.gz"
11
11
 
12
- InterPro.claim InterPro.protein_domains.find, :proc do
12
+ InterPro.claim InterPro.protein_domains, :proc do
13
13
  organism = "Hsa"
14
14
  uniprot_colum = TSV::Parser.new(Organism.protein_identifiers(organism).open).all_fields.index("UniProt/SwissProt Accession")
15
15
  uniprots = CMD.cmd("grep -v '^#'|cut -f #{uniprot_colum+1}", :in => Organism.protein_identifiers(organism).open).read.split("\n").collect{|l| l.split("|")}.flatten.uniq.reject{|l| l.empty?}
16
16
 
17
17
  tsv = nil
18
18
  TmpFile.with_file(uniprots * "\n") do |tmpfile|
19
- tsv = TSV.open(CMD.cmd("cut -f 1,2,5,6 | sort -u |grep -w -f #{ tmpfile }", :in => InterPro.source.protein2ipr.open, :pipe => true), :merge => true, :type => :double)
19
+ tsv = TSV.open(CMD.cmd("cut -f 1,2,5,6 | sort -u |grep -w -F -f #{ tmpfile }", :in => InterPro.source.protein2ipr.open, :pipe => true), :merge => true, :type => :double)
20
20
  end
21
21
 
22
22
  tsv.key_field = "UniProt/SwissProt Accession"
@@ -24,7 +24,7 @@ module InterPro
24
24
  tsv.to_s
25
25
  end
26
26
 
27
- InterPro.claim InterPro.domain_names.find, :proc do
27
+ InterPro.claim InterPro.domain_names, :proc do
28
28
  #tsv = InterPro.source.protein2ipr.tsv :key_field => 1, :fields => [2], :type => :single
29
29
  tsv = TSV.open(CMD.cmd("cut -f 2,3 | sort -u", :in => InterPro.source.protein2ipr.open, :pipe => true), :merge => true, :type => :single)
30
30
 
@@ -77,7 +77,7 @@ if defined? Entity
77
77
 
78
78
  property :genes => :array2single do
79
79
  InterPro.gene_index.values_at(*self).
80
- collect{|genes| genes = genes.uniq; genes.organism = organism if genes.respond_to? :organism; genes }.tap{|o| Gene.setup(o, "UniProt/SwissProt Accession", organism)}
80
+ collect{|genes| genes = [] if genes.nil?; genes = genes.uniq; genes.organism = organism if genes.respond_to? :organism; genes }.tap{|o| Gene.setup(o, "UniProt/SwissProt Accession", organism)}
81
81
  end
82
82
  end
83
83
 
@@ -8,22 +8,29 @@ module Genomes1000
8
8
 
9
9
  RELEASE_URL = "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20110521/ALL.wgs.phase1_release_v3.20101123.snps_indels_sv.sites.vcf.gz"
10
10
 
11
- Genomes1000.claim Genomes1000.mutations, :proc do
11
+ Genomes1000.claim Genomes1000.mutations, :proc do |filename|
12
12
 
13
- tsv = TSV.setup({}, :key_field => "Variant ID", :fields => ["Genomic Mutation"], :type => :single)
14
- Open.read(RELEASE_URL) do |line|
15
- next if line[0] == "#"[0]
13
+ begin
14
+ Open.write(filename) do |file|
15
+ file.puts "#: :type=:single#:namespace=Hsa"
16
+ file.puts "#Variant ID\tGenomic Mutation"
16
17
 
17
- chromosome, position, id, references, alternative, quality, filter, info = line.split("\t")
18
+ Open.read(RELEASE_URL) do |line|
19
+ next if line[0] == "#"[0]
18
20
 
19
- tsv[id] = [chromosome, position, alternative] * ":"
20
- end
21
-
22
- tsv.namespace = "Hsa"
21
+ chromosome, position, id, references, alternative, quality, filter, info = line.split("\t")
23
22
 
24
- tsv.to_s
23
+ file.puts [id, [chromosome, position, alternative] * ":"] * "\t"
24
+ end
25
+ end
26
+ rescue
27
+ FileUtils.rm filename if File.exists? filename
28
+ raise $!
29
+ end
30
+ nil
25
31
  end
26
32
 
33
+
27
34
  Genomes1000.claim Genomes1000.mutations_hg18, :proc do
28
35
  require 'rbbt/sources/organism'
29
36
 
@@ -31,7 +31,7 @@ module InterPro
31
31
  end
32
32
  end
33
33
 
34
- InterPro.claim InterPro.pfam_names.find, :proc do
34
+ InterPro.claim InterPro.pfam_names, :proc do
35
35
  pfam_domains = Pfam.domains.read.split("\n").collect{|l| l.split("\t").first}.compact.flatten
36
36
  tsv = nil
37
37
  TmpFile.with_file(pfam_domains * "\n") do |tmpfile|
@@ -42,7 +42,7 @@ InterPro.claim InterPro.pfam_names.find, :proc do
42
42
  tsv.to_s
43
43
  end
44
44
 
45
- InterPro.claim InterPro.pfam_equivalences.find, :proc do
45
+ InterPro.claim InterPro.pfam_equivalences, :proc do
46
46
  pfam_domains = Pfam.domains.read.split("\n").collect{|l| l.split("\t").first}.compact.flatten
47
47
  tsv = nil
48
48
  TmpFile.with_file(pfam_domains * "\n") do |tmpfile|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-sources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-21 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rbbt-util
@@ -136,12 +136,12 @@ files:
136
136
  - share/install/Organism/organism_helpers.rb
137
137
  - share/install/STITCH/Rakefile
138
138
  - share/install/lib/helpers.rb
139
- - test/test_helper.rb
140
- - test/rbbt/sources/test_entrez.rb
141
- - test/rbbt/sources/test_pubmed.rb
142
139
  - test/rbbt/sources/test_go.rb
140
+ - test/rbbt/sources/test_entrez.rb
143
141
  - test/rbbt/sources/test_biomart.rb
144
142
  - test/rbbt/sources/test_organism.rb
143
+ - test/rbbt/sources/test_pubmed.rb
144
+ - test/test_helper.rb
145
145
  homepage: http://github.com/mikisvaz/rbbt-sources
146
146
  licenses: []
147
147
  post_install_message:
@@ -167,9 +167,9 @@ signing_key:
167
167
  specification_version: 3
168
168
  summary: Data sources for the Ruby Bioinformatics Toolkit (rbbt)
169
169
  test_files:
170
- - test/test_helper.rb
171
- - test/rbbt/sources/test_entrez.rb
172
- - test/rbbt/sources/test_pubmed.rb
173
170
  - test/rbbt/sources/test_go.rb
171
+ - test/rbbt/sources/test_entrez.rb
174
172
  - test/rbbt/sources/test_biomart.rb
175
173
  - test/rbbt/sources/test_organism.rb
174
+ - test/rbbt/sources/test_pubmed.rb
175
+ - test/test_helper.rb