Class: Bio::GFF::GFF3::SequenceRegion
- Inherits:
-
Object
- Object
- Bio::GFF::GFF3::SequenceRegion
- Extended by:
- Escape
- Includes:
- Escape
- Defined in:
- lib/bio/db/gff.rb
Overview
Stores meta-data “##sequence-region seqid start end”.
Constant Summary
Constants included from Escape
Escape::UNSAFE, Escape::UNSAFE_ATTRIBUTE, Escape::UNSAFE_SEQID
Instance Attribute Summary collapse
-
#end ⇒ Object
end position.
-
#seqid ⇒ Object
sequence ID.
-
#start ⇒ Object
start position.
Class Method Summary collapse
-
.parse(str) ⇒ Object
parses given string and returns SequenceRegion class.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Returns true if self == other.
-
#initialize(seqid, start, endpos) ⇒ SequenceRegion
constructor
creates a new SequenceRegion class.
-
#to_s ⇒ Object
string representation.
Constructor Details
#initialize(seqid, start, endpos) ⇒ SequenceRegion
creates a new SequenceRegion class
1062 1063 1064 1065 1066 |
# File 'lib/bio/db/gff.rb', line 1062 def initialize(seqid, start, endpos) @seqid = seqid @start = start ? start.to_i : nil @end = endpos ? endpos.to_i : nil end |
Instance Attribute Details
#end ⇒ Object
end position
1082 1083 1084 |
# File 'lib/bio/db/gff.rb', line 1082 def end @end end |
#seqid ⇒ Object
sequence ID
1076 1077 1078 |
# File 'lib/bio/db/gff.rb', line 1076 def seqid @seqid end |
#start ⇒ Object
start position
1079 1080 1081 |
# File 'lib/bio/db/gff.rb', line 1079 def start @start end |
Class Method Details
.parse(str) ⇒ Object
parses given string and returns SequenceRegion class
1069 1070 1071 1072 1073 |
# File 'lib/bio/db/gff.rb', line 1069 def self.parse(str) _, seqid, start, endpos = str.chomp.split(/\s+/, 4).collect { |x| unescape(x) } self.new(seqid, start, endpos) end |
Instance Method Details
#==(other) ⇒ Object
Returns true if self == other. Otherwise, returns false.
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 |
# File 'lib/bio/db/gff.rb', line 1093 def ==(other) if other.class == self.class and other.seqid == self.seqid and other.start == self.start and other.end == self.end then true else false end end |
#to_s ⇒ Object
string representation
1085 1086 1087 1088 1089 1090 |
# File 'lib/bio/db/gff.rb', line 1085 def to_s i = escape_seqid(column_to_s(@seqid)) s = escape_seqid(column_to_s(@start)) e = escape_seqid(column_to_s(@end)) "##sequence-region #{i} #{s} #{e}\n" end |