Module: Gene

Defined in:
lib/rbbt/sources/go.rb,
lib/rbbt/sources/NCI.rb,
lib/rbbt/sources/kegg.rb,
lib/rbbt/sources/pfam.rb,
lib/rbbt/sources/pina.rb,
lib/rbbt/sources/string.rb,
lib/rbbt/sources/tfacts.rb,
lib/rbbt/sources/reactome.rb

Constant Summary collapse

INDEX_CACHE =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gene_kegg_pathway_indexObject



102
103
104
105
# File 'lib/rbbt/sources/kegg.rb', line 102

def self.gene_kegg_pathway_index
  @@gene_kegg_pathway_index ||= 
    KEGG.gene_pathway.tsv(:persist => true, :key_field => "KEGG Gene ID", :fields => ["KEGG Pathway ID"], :type => :flat, :merge => true)
end

Instance Method Details

#from_keggObject



93
94
95
96
97
98
99
100
# File 'lib/rbbt/sources/kegg.rb', line 93

def from_kegg
  return self unless format == "KEGG Gene ID"
  if Array === self
    Gene.setup(KEGG.index2ens.values_at(*self), "Ensembl Gene ID", organism).tap{|o| o.extend AnnotatedArray if AnnotatedArray === self }
  else
    Gene.setup(KEGG.index2ens[self], "Ensembl Gene ID", organism).tap{|o| o.extend AnnotatedArray if AnnotatedArray === self }
  end
end

#to_keggObject



84
85
86
87
88
89
90
91
# File 'lib/rbbt/sources/kegg.rb', line 84

def to_kegg
  return self if format == "KEGG Gene ID"
  if Array === self
    Gene.setup(KEGG.index2kegg.values_at(*to("Ensembl Gene ID")), "KEGG Gene ID", organism).tap{|o| o.extend AnnotatedArray if AnnotatedArray === self }
  else
    Gene.setup(KEGG.index2kegg[to("Ensembl Gene ID")], "KEGG Gene ID", organism).tap{|o| o.extend AnnotatedArray if AnnotatedArray === self }
  end
end