Sha256: 60b699ea5d9d0edc4b1919c57f33d1f4f4f3949aad51ba01a5ccd515b0651f6b

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

# Copyright 2014, 2015 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

8 entries across 8 versions & 1 rubygems

Version Path
parse_fasta-1.7.1 spec/lib/quality_spec.rb
parse_fasta-1.7.0 spec/lib/quality_spec.rb
parse_fasta-1.6.2 spec/lib/quality_spec.rb
parse_fasta-1.6.1 spec/lib/quality_spec.rb
parse_fasta-1.6.0 spec/lib/quality_spec.rb
parse_fasta-1.5.2 spec/lib/quality_spec.rb
parse_fasta-1.5.1 spec/lib/quality_spec.rb
parse_fasta-1.5.0 spec/lib/quality_spec.rb