class Bio::GFF::GFF3::Record::Target

Bio:GFF::GFF3::Record::Target is a class to store data of “Target” attribute.

Attributes

end[RW]

end position

start[RW]

start position

strand[RW]

strand (optional). Normally, “+” or “-”, or nil.

target_id[RW]

target ID

Public Class Methods

new(target_id, start, endpos, strand = nil) click to toggle source

Creates a new Target object.

# File lib/bio/db/gff.rb, line 1196
def initialize(target_id, start, endpos, strand = nil)
  @target_id = target_id
  @start = start ? start.to_i : nil
  @end = endpos ? endpos.to_i : nil
  @strand = strand
end
parse(str) click to toggle source

parses “target_id start end [strand]”-style string (for example, “ABC789 123 456 +”) and creates a new Target object.

# File lib/bio/db/gff.rb, line 1219
def self.parse(str)
  target_id, start, endpos, strand =
    str.split(/ +/, 4).collect { |x| unescape(x) }
  self.new(target_id, start, endpos, strand)
end

Public Instance Methods

==(other) click to toggle source

Returns true if self == other. Otherwise, returns false.

# File lib/bio/db/gff.rb, line 1236
def ==(other)
  if other.class == self.class and
      other.target_id == self.target_id and
      other.start == self.start and
      other.end == self.end and
      other.strand == self.strand then
    true
  else
    false
  end
end
to_s() click to toggle source

returns a string

# File lib/bio/db/gff.rb, line 1226
def to_s
  i = escape_seqid(column_to_s(@target_id))
  s = escape_attribute(column_to_s(@start))
  e = escape_attribute(column_to_s(@end))
  strnd = escape_attribute(@strand.to_s)
  strnd = " " + strnd unless strnd.empty?
  "#{i} #{s} #{e}#{strnd}"
end