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