Class Bio::GFF::GFF3::Record::Target
In: lib/bio/db/gff.rb
Parent: Object

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

Methods

==   new   parse   to_s  

Included Modules

GFF3::Escape

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

Creates a new Target object.

[Source]

      # File lib/bio/db/gff.rb, line 1197
1197:           def initialize(target_id, start, endpos, strand = nil)
1198:             @target_id = target_id
1199:             @start = start ? start.to_i : nil
1200:             @end = endpos ? endpos.to_i : nil
1201:             @strand = strand
1202:           end

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

[Source]

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

Public Instance methods

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

[Source]

      # File lib/bio/db/gff.rb, line 1237
1237:           def ==(other)
1238:             if other.class == self.class and
1239:                 other.target_id == self.target_id and
1240:                 other.start == self.start and
1241:                 other.end == self.end and
1242:                 other.strand == self.strand then
1243:               true
1244:             else
1245:               false
1246:             end
1247:           end

returns a string

[Source]

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

[Validate]