class MgNu::Sequence::Fastq

Attributes

header[RW]
header_description[RW]
header_name[RW]
offset[RW]
qualary[RW]
qualhdr[RW]
quality[RW]

Public Class Methods

new(options) click to toggle source

create a new MgNu::Sequence::Fastq object

Calls superclass method MgNu::Sequence::new
# File lib/mgnu/sequence/fastq.rb, line 10
def initialize(options)
  super(options)
  options = {:offset => 64, :header => nil, :quality => nil}.merge! options
  @quality = options[:quality]
  @offset = options[:offset]
  @header = options[:header]
  temp = @header.split
  @header_name = temp.shift
  @header_description = temp.length > 0 ? temp.join(' ') : nil
  @qualhdr = options[:qualhdr] if options[:qualhdr]
end

Public Instance Methods

to_fasta() click to toggle source
# File lib/mgnu/sequence/fastq.rb, line 22
def to_fasta
  MgNu::Sequence::Fasta.new(:header => @header, :sequence => sequence)
end
to_s() click to toggle source

override to_s representation

# File lib/mgnu/sequence/fastq.rb, line 27
def to_s
  "@#{@header}\n#{sequence}\n+\n#{@quality}\n"
end
unpack_quality() click to toggle source

Unpack the quality string and return an array of

offset-corrected integers

@params [Integer] offset platform dependent offset value to

substract from the quality score, defaults to most recent
platform (i.e. illumina)
(64)

@return [Array] the array of integers

# File lib/mgnu/sequence/fastq.rb, line 38
def unpack_quality # only compute this one time
  @quality.unpack('C*').map! { |x| x - @offset }
end