class OboParser::OboParser::Stanza

A collection of single lines (Tags)

Attributes

def[RW]

Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags

id[RW]

Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags

name[RW]

Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags

other_tags[RW]

Make special reference to several specific types of tags (:name, :id), subclasses will remove additional special typs from :other_tags

Public Class Methods

new(tags) click to toggle source
# File lib/obo_parser.rb, line 60
def initialize(tags)
  @other_tags = []

  while tags.length != 0
    t = tags.shift

    new_tag = OboParser::Tag.new
    
    new_tag.tag = t.tag
    new_tag.value = t.value
    new_tag.comment = t.comment
    new_tag.xrefs = t.xrefs 

    case new_tag.tag
    when 'id' 
      @id = new_tag
    when 'name'
      @name = new_tag
    when 'def'
      @def = new_tag
    else
      if new_tag.tag == 'relationship'
        new_tag.related_term = t.related_term
        new_tag.relation = t.relation
      end

      @other_tags.push(new_tag)
    end
  end
end

Public Instance Methods

tags_named(tag_name = nil) click to toggle source

Convienience methods

# File lib/obo_parser.rb, line 93
def tags_named(tag_name = nil)
  return nil if tag_name.nil?
  result = []
  @other_tags.each do |t|
    result.push(t) if (t.tag == tag_name)
  end
  result
end