Class: Bio::DB::Fasta::Entry
- Inherits:
-
Object
- Object
- Bio::DB::Fasta::Entry
- Defined in:
- lib/bio/db/fastadb.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#length ⇒ Object
(also: #size)
readonly
Returns the value of attribute length.
-
#line_bases ⇒ Object
readonly
Returns the value of attribute line_bases.
-
#line_length ⇒ Object
readonly
Returns the value of attribute line_length.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
Instance Method Summary collapse
- #get_base_coordinate(coordinate) ⇒ Object
- #get_full_region ⇒ Object (also: #to_region)
-
#initialize(id, length, offset = 0, line_bases = 0, line_length = 0) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(id, length, offset = 0, line_bases = 0, line_length = 0) ⇒ Entry
Returns a new instance of Entry.
50 51 52 53 54 55 56 |
# File 'lib/bio/db/fastadb.rb', line 50 def initialize(id, length, offset = 0 , line_bases= 0 , line_length = 0 ) @id=id @length=length.to_i @offset = offset.to_i @line_bases = line_bases.to_i @line_length = line_length.to_i end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
48 49 50 |
# File 'lib/bio/db/fastadb.rb', line 48 def id @id end |
#length ⇒ Object (readonly) Also known as: size
Returns the value of attribute length.
48 49 50 |
# File 'lib/bio/db/fastadb.rb', line 48 def length @length end |
#line_bases ⇒ Object (readonly)
Returns the value of attribute line_bases.
48 49 50 |
# File 'lib/bio/db/fastadb.rb', line 48 def line_bases @line_bases end |
#line_length ⇒ Object (readonly)
Returns the value of attribute line_length.
48 49 50 |
# File 'lib/bio/db/fastadb.rb', line 48 def line_length @line_length end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
48 49 50 |
# File 'lib/bio/db/fastadb.rb', line 48 def offset @offset end |
Instance Method Details
#get_base_coordinate(coordinate) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/bio/db/fastadb.rb', line 58 def get_base_coordinate(coordinate) lines_for_offset = coordinate / line_bases line_offset = coordinate % line_bases #puts "get_base_coordinate" #puts "Coordinate: #{coordinate}" #puts "lines_for_offset: #{lines_for_offset}" #puts "line pffset: #{line_offset}" #puts self.inspect pointer = offset + (line_length * lines_for_offset) + line_offset - 1 pointer end |