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

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.

entry_id[R]

Returns Db_Object_Id variable. Alias to entry_id.

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.

Public Class Methods

new(entry) click to toggle source

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
parser(str) { |gene_association| ... } click to toggle source

Retruns 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

goid(org = nil) click to toggle source

Returns GO_ID in /d{7}/ format. Giving not nil arg, returns /GO:d{7}/ style.

    # 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
to_str() click to toggle source

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