class FastaRead::Sequence

Public Class Methods

new(fasta, chromosome, cstart, cend) click to toggle source
# File lib/fasta_read/sequence.rb, line 8
def initialize(fasta, chromosome, cstart, cend)
  @fasta =  fasta.gsub("\n", "")
  @chromosome = ">#{chromosome}"
  @cstart = cstart.to_i
  @cend =   cend.to_i
end

Public Instance Methods

process() click to toggle source
# File lib/fasta_read/sequence.rb, line 15
def process
  @fasta[real_cstart..real_cend]
end
real_cend() click to toggle source
# File lib/fasta_read/sequence.rb, line 25
def real_cend
  @cend - 1 + @chromosome.length
end
real_cstart() click to toggle source
# File lib/fasta_read/sequence.rb, line 19
def real_cstart
  cstart = @cstart
  cstart -= 1 unless @cstart == 0
  cstart + @chromosome.length
end