Sha256: bd2e80b3d0195f6dfd82006a66da105b2157c560687c0fbd4237d97e95a60e10

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

require 'fileutils'

module FastaRead
  class Sequence
    include Methadone::Main
    include Methadone::CLILogging

    def initialize(fasta, chromosome, cstart, cend)
      @fasta =  fasta.gsub("\n", "")
      @chromosome = ">#{chromosome}"
      @cstart = cstart.to_i
      @cend =   cend.to_i
    end

    def process
      @fasta[real_cstart..real_cend]
    end

    def real_cstart
      cstart = @cstart
      cstart -= 1 unless @cstart == 0
      cstart + @chromosome.length
    end

    def real_cend
      @cend - 1 + @chromosome.length
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fasta_read-2.0.3 lib/fasta_read/sequence.rb
fasta_read-2.0.2 lib/fasta_read/sequence.rb
fasta_read-2.0.1 lib/fasta_read/sequence.rb