Class | Bio::GO::GeneAssociation |
In: |
lib/bio/db/go.rb
|
Parent: | Object |
$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
DELIMITER | = | "\n" | Delimiter | |
RS | = | DELIMITER | Delimiter |
db_object_id | -> | entry_id |
aspect | [R] | Returns Aspect valiable. |
assigned_by | [R] | |
date | [R] | Returns Date variable. |
db | [R] | Returns DB variable. |
db_object_id | [R] | Returns Db_Object_Id variable. Alias to entry_id. |
db_object_name | [R] | |
db_object_symbol | [R] | Returns Db_Object_Symbol variable. |
db_object_synonym | [R] | |
db_object_type | [R] | Returns Db_Object_Type variable. |
db_reference | [R] | Returns Db_Reference variable. |
evidence | [R] | Retruns Evidence code variable. |
qualifier | [R] | Returns Db_Object_Name variable. |
taxon | [R] | Returns Taxon variable. |
with | [R] | Returns the entry is associated with this value. |
Parsing an entry (in a line) in the gene_association flatfile.
# File lib/bio/db/go.rb, line 261 261: def initialize(entry) 262: tmp = entry.chomp.split(/\t/) 263: @db = tmp[0] 264: @db_object_id = tmp[1] 265: @db_object_symbol = tmp[2] 266: @qualifier = tmp[3] # 267: @goid = tmp[4] 268: @db_reference = tmp[5].split(/\|/) # 269: @evidence = tmp[6] 270: @with = tmp[7].split(/\|/) # 271: @aspect = tmp[8] 272: @db_object_name = tmp[9] # 273: @db_object_synonym = tmp[10].split(/\|/) # 274: @db_object_type = tmp[11] 275: @taxon = tmp[12] # taxon:4932 276: @date = tmp[13] # 20010118 277: @assigned_by = tmp[14] 278: end
Retruns an Array of parsed gene_association flatfile. Block is acceptable.
# File lib/bio/db/go.rb, line 199 199: def self.parser(str) 200: if block_given? 201: str.each_line(DELIMITER) {|line| 202: next if /^!/ =~ line 203: yield GeneAssociation.new(line) 204: } 205: else 206: galist = [] 207: str.each_line(DELIMITER) {|line| 208: next if /^!/ =~ line 209: galist << GeneAssociation.new(line) 210: } 211: return galist 212: end 213: end
Returns GO_ID in /\d{7}/ format. Giving not nil arg, returns /GO:\d{7}/ style.
# File lib/bio/db/go.rb, line 286 286: def goid(org = nil) 287: if org 288: @goid 289: else 290: @goid.sub('GO:','') 291: end 292: end
Bio::GO::GeneAssociation#to_str -> a line of gene_association file.
# File lib/bio/db/go.rb, line 295 295: def to_str 296: return [@db, @db_object_id, @db_object_symbol, @qualifier, @goid, 297: @db_reference.join("|"), @evidence, @with.join("|"), @aspect, 298: @db_object_name, @db_object_synonym.join("|"), @db_object_type, 299: @taxon, @date, @assigned_by].join("\t") 300: end