Class: Fasta::Chrom
Instance Attribute Summary collapse
-
#centromere ⇒ Object
readonly
Returns the value of attribute centromere.
-
#seqname ⇒ Object
readonly
Returns the value of attribute seqname.
-
#size ⇒ Object
(also: #stop)
readonly
Returns the value of attribute size.
-
#start ⇒ Object
(also: #pos)
readonly
Returns the value of attribute start.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #file_pos(pos) ⇒ Object
-
#initialize(n, fasta, sz, st, t) ⇒ Chrom
constructor
A new instance of Chrom.
- #p ⇒ Object
- #q ⇒ Object
- #set_cen_pos(pos) ⇒ Object
Methods included from GenomicLocus
#default_stop, #loc, #long_chrom, #range, #short_chrom
Methods included from IntervalList::Interval
#above?, #below?, #center, #clone, #contains?, #diff, #dist, #intersect, #overlaps?, #union
Constructor Details
#initialize(n, fasta, sz, st, t) ⇒ Chrom
Returns a new instance of Chrom.
37 38 39 40 41 42 |
# File 'lib/fasta.rb', line 37 def initialize n, fasta, sz, st, t @seqname, @fasta, @size, @byte_start, @total = n, fasta, sz, st, t # truncate the name @seqname = short_chrom @start = 1 end |
Instance Attribute Details
#centromere ⇒ Object (readonly)
Returns the value of attribute centromere.
34 35 36 |
# File 'lib/fasta.rb', line 34 def centromere @centromere end |
#seqname ⇒ Object (readonly)
Returns the value of attribute seqname.
34 35 36 |
# File 'lib/fasta.rb', line 34 def seqname @seqname end |
#size ⇒ Object (readonly) Also known as: stop
Returns the value of attribute size.
34 35 36 |
# File 'lib/fasta.rb', line 34 def size @size end |
#start ⇒ Object (readonly) Also known as: pos
Returns the value of attribute start.
34 35 36 |
# File 'lib/fasta.rb', line 34 def start @start end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
34 35 36 |
# File 'lib/fasta.rb', line 34 def total @total end |
Instance Method Details
#file_pos(pos) ⇒ Object
44 45 46 47 |
# File 'lib/fasta.rb', line 44 def file_pos pos return nil if !contains? pos @byte_start + pos/line_size*(line_size+1) + (pos % line_size) - 1 - ((pos % line_size == 0) ? 1 : 0) end |
#p ⇒ Object
53 54 55 56 57 |
# File 'lib/fasta.rb', line 53 def p if @centromere @p ||= GenomicLocus::Region.new @seqname, 1, @centromere end end |
#q ⇒ Object
59 60 61 62 63 |
# File 'lib/fasta.rb', line 59 def q if @centromere @q ||= GenomicLocus::Region.new @seqname, @centromere+1, stop end end |
#set_cen_pos(pos) ⇒ Object
49 50 51 |
# File 'lib/fasta.rb', line 49 def set_cen_pos pos @centromere = pos end |