Sha256: 92c56e3adfc670d43ab7ba7a7209e85e4c51fc48be16ba1bdd8bae6d170eb84c

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

require 'fileutils'

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

    attr_reader :separate_lines

    def initialize(fasta, chromosome, cstart, cend)
      @fasta =  fasta.gsub("\n", "")
      @chromosome = ">chr#{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

1 entries across 1 versions & 1 rubygems

Version Path
fasta_read-1.1.0 lib/fasta_read/sequence.rb