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

new(target_id, start, endpos, strand = nil)

Creates a new Target object.

[Source]

          # File lib/bio/db/gff.rb, line 1168
    1168:           def initialize(target_id, start, endpos, strand = nil)
    1169:             @target_id = target_id
    1170:             @start = start ? start.to_i : nil
    1171:             @end = endpos ? endpos.to_i : nil
    1172:             @strand = strand
    1173:           end

parse(str)

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 1191
    1191:           def self.parse(str)
    1192:             target_id, start, endpos, strand =
    1193:               str.split(/ +/, 4).collect { |x| URI.unescape(x) }
    1194:             self.new(target_id, start, endpos, strand)
    1195:           end

### Public Instance methods

==(other)

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

[Source]

          # File lib/bio/db/gff.rb, line 1208
    1208:           def ==(other)
    1209:             if other.class == self.class and
    1210:                 other.target_id == self.target_id and
    1211:                 other.start == self.start and
    1212:                 other.end == self.end and
    1213:                 other.strand == self.strand then
    1214:               true
    1215:             else
    1216:               false
    1217:             end
    1218:           end

to_s()

returns a string

[Source]

          # File lib/bio/db/gff.rb, line 1198
    1198:           def to_s
    1199:             i = escape_seqid(column_to_s(@target_id))
    1200:             s = escape_attribute(column_to_s(@start))
    1201:             e = escape_attribute(column_to_s(@end))
    1202:             strnd = escape_attribute(@strand.to_s)
    1203:             strnd = " " + strnd unless strnd.empty?
    1204:             "#{i} #{s} #{e}#{strnd}"
    1205:           end

[Validate]