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

Stores meta-data "#sequence-region seqid start end".

Methods

==   new   parse   to_s  

Included Modules

Escape

Attributes

end  [RW]  end position
seqid  [RW]  sequence ID
start  [RW]  start position

Public Class methods

creates a new SequenceRegion class

[Source]

      # File lib/bio/db/gff.rb, line 1033
1033:         def initialize(seqid, start, endpos)
1034:           @seqid = seqid
1035:           @start = start ? start.to_i : nil
1036:           @end = endpos ? endpos.to_i : nil
1037:         end

parses given string and returns SequenceRegion class

[Source]

      # File lib/bio/db/gff.rb, line 1040
1040:         def self.parse(str)
1041:           dummy, seqid, start, endpos =
1042:             str.chomp.split(/\s+/, 4).collect { |x| URI.unescape(x) }
1043:           self.new(seqid, start, endpos)
1044:         end

Public Instance methods

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

[Source]

      # File lib/bio/db/gff.rb, line 1064
1064:         def ==(other)
1065:           if other.class == self.class and
1066:               other.seqid == self.seqid and
1067:               other.start == self.start and
1068:               other.end == self.end then
1069:             true
1070:           else
1071:             false
1072:           end
1073:         end

string representation

[Source]

      # File lib/bio/db/gff.rb, line 1056
1056:         def to_s
1057:           i = escape_seqid(column_to_s(@seqid))
1058:           s = escape_seqid(column_to_s(@start))
1059:           e = escape_seqid(column_to_s(@end))
1060:           "##sequence-region #{i} #{s} #{e}\n"
1061:         end

[Validate]