Sha256: 2e992048cb76d06552a2db731646c8b35b4ba95e8a07583411a01cd79c0bdefd

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'rbbt-util'
require 'rbbt/resource'

module PRO
  extend Resource
  self.subdir = 'share/databases/PRO'

  def self.organism(org="Hsa")
    require 'rbbt/sources/organism'
    Organism.default_code(org)
  end

  #self.search_paths = {}
  #self.search_paths[:default] = :lib

  PRO.claim PRO.identifiers, :proc do 
    url = "ftp://ftp.proteininformationresource.org/databases/ontology/pro_obo/PRO_mappings/uniprotmapping.txt"

    dumper = TSV::Dumper.new :key_field => "PRO ID", :fields => ["UniProt/SwissProt Accession"], :type => :double, :namespace => PRO.organism
    dumper.init
    TSV.traverse Open.open(url), :type => :array, :into => dumper, :bar => true do |line|
      pro, uni = line.split("\t")
      [pro, [uni.split(":").last]]
    end
    dumper.tsv merge: true
  end

  PRO.claim PRO.uniprot_equivalences, :proc do
    
    dumper = TSV::Dumper.new :key_field => "UniProt/SwissProt Accession", :fields => ["UniProt/SwissProt Accession"], :type => :flat, :namespace => PRO.organism
    dumper.init
    TSV.traverse PRO.identifiers, :into => dumper,  :bar => true do |pro,values|
      res = []
      res.extend MultipleResult
      unis = values.flatten

      unis.flatten.each do |uni|
        res << [uni,unis]
      end

      res
    end
  end
end

iif PRO.identifiers.produce(true).find if __FILE__ == $0
iif PRO.uniprot_equivalences.produce(true).find if __FILE__ == $0

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbbt-sources-3.4.2 lib/rbbt/sources/PRO.rb
rbbt-sources-3.4.1 lib/rbbt/sources/PRO.rb
rbbt-sources-3.3.0 lib/rbbt/sources/PRO.rb
rbbt-sources-3.2.16 lib/rbbt/sources/PRO.rb