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, line 260
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
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, line 198
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

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.

  • #goid -> “001234”

  • #goid -> “GO:001234”

# File lib/bio/db/go.rb, line 285
def goid(org = nil)
  if org
    @goid
  else
    @goid.sub('GO:','')
  end
end
to_str() click to toggle source

#to_str -> a line of gene_association file.

# File lib/bio/db/go.rb, line 294
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