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
1199 def initialize(target_id, start, endpos, strand = nil)
1200   @target_id = target_id
1201   @start = start ? start.to_i : nil
1202   @end = endpos ? endpos.to_i : nil
1203   @strand = strand
1204 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
1222 def self.parse(str)
1223   target_id, start, endpos, strand =
1224     str.split(/ +/, 4).collect { |x| unescape(x) }
1225   self.new(target_id, start, endpos, strand)
1226 end

Public Instance Methods

==(other) click to toggle source

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

     # File lib/bio/db/gff.rb
1239 def ==(other)
1240   if other.class == self.class and
1241       other.target_id == self.target_id and
1242       other.start == self.start and
1243       other.end == self.end and
1244       other.strand == self.strand then
1245     true
1246   else
1247     false
1248   end
1249 end
to_s() click to toggle source

returns a string

     # File lib/bio/db/gff.rb
1229 def to_s
1230   i = escape_seqid(column_to_s(@target_id))
1231   s = escape_attribute(column_to_s(@start))
1232   e = escape_attribute(column_to_s(@end))
1233   strnd = escape_attribute(@strand.to_s)
1234   strnd = " " + strnd unless strnd.empty?
1235   "#{i} #{s} #{e}#{strnd}"
1236 end