def test_generate_histogram(self):
        """ No errors when calling function, creates output files"""
        
        # Cannot test content of graphics file, only successful execution
        
        output_dir = self.output_dir
        
        
        # Should not raise an error with good data
        
        generate_histogram(self.qual_fp, output_dir, verbose = False)
        
        expected_outfile = output_dir + 'quality_scores_plot.pdf'
        
        self.assertTrue(isfile(expected_outfile))
        
        # Test text file output for proper data
        text_output_fp = output_dir + "quality_bins.txt"
        
        text_output_f = open(text_output_fp, "U")
        
        actual_text_output = "\n".join([line.strip() for line in text_output_f])


        self.assertEqual(actual_text_output, self.expected_output_text_file)
def main():
    option_parser, opts, args =\
     parse_command_line_parameters(suppress_verbose=True, **script_info)
      
    qual_fp = opts.qual_fp
    output_dir = opts.output_dir
    score_min = int(opts.score_min)
    verbose = opts.verbose
    
    create_dir(output_dir)
    
    generate_histogram(qual_fp, output_dir, score_min, verbose)
def main():
    option_parser, opts, args =\
        parse_command_line_parameters(suppress_verbose=True, **script_info)

    qual_fp = opts.qual_fp
    output_dir = opts.output_dir
    score_min = int(opts.score_min)
    verbose = opts.verbose

    create_dir(output_dir)

    generate_histogram(qual_fp,
                       output_dir,
                       score_min,
                       verbose,
                       qual_parser=parse_qual_score)
Exemple #4
0
def main():
    option_parser, opts, args =\
     parse_command_line_parameters(suppress_verbose=True, **script_info)
      
    qual_fp = opts.qual_fp
    output_dir = opts.output_dir
    score_min = int(opts.score_min)
    verbose = opts.verbose
    
    create_dir(output_dir)
    
    if qual_fp.endswith('.fastq') or qual_fp.endswith('.fastq.gz'):
        qual_parser = parse_fastq_qual_score
    else:
        qual_parser = parse_qual_score
    
    generate_histogram(qual_fp,
                       output_dir,
                       score_min,
                       verbose,
                       qual_parser=qual_parser)
Exemple #5
0
def main():
    option_parser, opts, args =\
        parse_command_line_parameters(suppress_verbose=True, **script_info)

    qual_fp = opts.qual_fp
    output_dir = opts.output_dir
    score_min = int(opts.score_min)
    verbose = opts.verbose

    create_dir(output_dir)

    if qual_fp.endswith('.fastq') or qual_fp.endswith('.fastq.gz'):
        qual_parser = parse_fastq_qual_score
    else:
        qual_parser = parse_qual_score

    generate_histogram(qual_fp,
                       output_dir,
                       score_min,
                       verbose,
                       qual_parser=qual_parser)
Exemple #6
0
    def test_generate_histogram(self):
        """ No errors when calling function, creates output files"""

        # Cannot test content of graphics file, only successful execution

        output_dir = self.output_dir

        # Should not raise an error with good data
        generate_histogram(self.qual_fp, output_dir, verbose=False)

        expected_outfile = output_dir + 'quality_scores_plot.pdf'

        self.assertTrue(isfile(expected_outfile))

        # Test text file output for proper data
        text_output_fp = output_dir + "quality_bins.txt"

        text_output_f = open(text_output_fp, "U")

        actual_text_output = "\n".join(
            [line.strip() for line in text_output_f])

        self.assertEqual(actual_text_output, self.expected_output_text_file)