$CVSROOT/go/gene-associations/gene_association.*
Data parser for the gene_association go annotation. See also the file format www.geneontology.org/doc/GO.annotation.html#file
mgi_data = File.open('gene_association.mgi').read mgi = Bio::GO::GeneAssociation.parser(mgi_data) Bio::GO::GeneAssociation.parser(mgi_data) do |entry| p [entry.entry_id, entry.evidence, entry.goid] end
Parsing an entry (in a line) in the gene_association flatfile.
# File lib/bio/db/go.rb, line 261 def initialize(entry) tmp = entry.chomp.split(/\t/) @db = tmp[0] @db_object_id = tmp[1] @db_object_symbol = tmp[2] @qualifier = tmp[3] # @goid = tmp[4] @db_reference = tmp[5].split(/\|/) # @evidence = tmp[6] @with = tmp[7].split(/\|/) # @aspect = tmp[8] @db_object_name = tmp[9] # @db_object_synonym = tmp[10].split(/\|/) # @db_object_type = tmp[11] @taxon = tmp[12] # taxon:4932 @date = tmp[13] # 20010118 @assigned_by = tmp[14] end
Retruns an Array of parsed gene_association flatfile. Block is acceptable.
# File lib/bio/db/go.rb, line 199 def self.parser(str) if block_given? str.each_line(DELIMITER) {|line| next if /^!/ =~ line yield GeneAssociation.new(line) } else galist = [] str.each_line(DELIMITER) {|line| next if /^!/ =~ line galist << GeneAssociation.new(line) } return galist end end
Returns GO_ID in /d{7}/ format. Giving not nil arg, returns /GO:d{7}/ style.
Bio::GO::GeneAssociation#goid -> "001234"
Bio::GO::GeneAssociation#goid(true) -> "GO:001234"
# File lib/bio/db/go.rb, line 286 def goid(org = nil) if org @goid else @goid.sub('GO:','') end end
Bio::GO::GeneAssociation#to_str -> a line of gene_association file.
# File lib/bio/db/go.rb, line 295 def to_str return [@db, @db_object_id, @db_object_symbol, @qualifier, @goid, @db_reference.join("|"), @evidence, @with.join("|"), @aspect, @db_object_name, @db_object_synonym.join("|"), @db_object_type, @taxon, @date, @assigned_by].join("\t") end
Generated with the Darkfish Rdoc Generator 2.