Class | Bio::GO::Ontology |
In: |
lib/bio/db/go.rb
|
Parent: | Bio::Pathway |
Container class for ontologies in the DAG Edit format.
c_data = File.open('component.oontology').read go_c = Bio::GO::Ontology.new(c_data) p go_c.bfs_shortest_path('0003673','0005632')
header_lines | [R] | Returns a Hash instance of the header lines in ontology flatfile. |
id2id | [R] | |
id2term | [R] |
Bio::GO::Ontology.new(str) The DAG Edit format ontology data parser.
# File lib/bio/db/go.rb, line 69 69: def initialize(str) 70: @id2term = {} 71: @header_lines = {} 72: @id2id = {} 73: adj_list = dag_edit_format_parser(str) 74: super(adj_list) 75: end
Bio::GO::Ontology.parse_ogids(line)
Parsing GOID line in the DAGEdit format
GO:ID[ ; GO:ID...]
# File lib/bio/db/go.rb, line 40 40: def self.parse_goids(line) 41: goids = [] 42: loop { 43: if /^ *[$%<]\S.+?;/ =~ line 44: endpoint = line.index(';') + 1 45: line = line[endpoint..line.size] 46: elsif /^,* GO:(\d{7}),*/ =~ line 47: goids << $1.clone 48: endpoint = line.index(goids.last) + goids.last.size 49: line = line[endpoint..line.size] 50: else 51: break 52: end 53: } 54: return goids 55: end