Sha256: 236f1a3767797398eb551598f98192eb944144d3b2cea9470e57a255101084aa

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

# Copyright 2014 Ryan Moore
# Contact: moorer@udel.edu
#
# This file is part of parse_fasta.
#
# parse_fasta is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# parse_fasta is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with parse_fasta.  If not, see <http://www.gnu.org/licenses/>.

require 'spec_helper'
require 'bio'

describe Quality do
  let(:qual_string) { qual_string = Quality.new('ab%63:K') }
  let(:bioruby_qual_scores) do 
    Bio::Fastq.new("@seq1\nACTGACT\n+\n#{qual_string}").quality_scores
  end

  describe "#qual_scores" do
    context "with illumina style quality scores" do
      it "returns an array of quality scores" do
        expect(qual_string.qual_scores).to eq bioruby_qual_scores
      end
    end
  end

  describe "#mean_qual" do
    it "returns the mean quality for the quality string" do
      len = qual_string.length.to_f
      mean_quality = qual_string.qual_scores.reduce(:+) / len
      expect(qual_string.mean_qual).to eq mean_quality
    end
  end             
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
parse_fasta-1.4.0 spec/lib/quality_spec.rb
parse_fasta-1.3.0 spec/lib/quality_spec.rb
parse_fasta-1.2.0 spec/lib/quality_spec.rb