def test_handle_no_reads_map_to_reverse_strand(self): """Fastqstrand handles case when no reads map to reverse strand """ self._write_file( """#fastq_strand version: 0.0.3 #Aligner: STAR #Reads in subset: 6 #Genome 1st forward 2nd reverse human 100.00 0.00 """) fastq_strand = Fastqstrand(self.fastq_strand_txt) self.assertEqual(fastq_strand.version, '0.0.3') self.assertEqual(fastq_strand.txt, self.fastq_strand_txt) self.assertEqual(fastq_strand.genomes, [ 'human', ]) self.assertEqual(fastq_strand.stats['human'].forward, 100.00) self.assertEqual(fastq_strand.stats['human'].reverse, 0.00) self.assertEqual(fastq_strand.stats['human'].ratio, float("+inf")) self.assertEqual(fastq_strand.stats['human'].strandedness, "forward")
def test_handle_fastq_strand_0_0_1(self): """Fastqstrand handles output from version 0.0.1 """ self._write_file( """#fastq_strand version: 0.0.1 #Aligner: STAR #Reads in subset: 3 #Genome 1st forward 2nd reverse hg38 13.13 93.21 mm10 15.02 91.18 """) fastq_strand = Fastqstrand(self.fastq_strand_txt) self.assertEqual(fastq_strand.version, '0.0.1') self.assertEqual(fastq_strand.txt, self.fastq_strand_txt) self.assertEqual(fastq_strand.genomes, ['hg38', 'mm10']) self.assertEqual(fastq_strand.stats['hg38'].forward, 13.13) self.assertEqual(fastq_strand.stats['hg38'].reverse, 93.21) self.assertEqual("%.4f" % fastq_strand.stats['hg38'].ratio, "%.4f" % 0.140864714) self.assertEqual(fastq_strand.stats['hg38'].strandedness, "reverse") self.assertEqual(fastq_strand.stats['mm10'].forward, 15.02) self.assertEqual(fastq_strand.stats['mm10'].reverse, 91.18) self.assertEqual("%.4f" % fastq_strand.stats['mm10'].ratio, "%.4f" % 0.164729107) self.assertEqual(fastq_strand.stats['mm10'].strandedness, "reverse")