コード例 #1
0
 def test_pileup_query_qualities_are_equal(self):
     samtools_result = build_query_qualities_with_samtoolspipe(self.fn)
     pysam_result = build_query_qualities_with_pysam(self.fn)
     pysam_result = [
         [chr(min(126, x + 33)) for x in l] for l in pysam_result]
     self.assertEqual("".join(flatten_nested_list(pysam_result)),
                      "".join(flatten_nested_list(samtools_result)))
コード例 #2
0
    def test_pileup_mapping_qualities_are_equal(self):
        samtools_result = PileupTestUtils.build_mapping_qualities_with_samtoolspipe(
            self.fn)
        pysam_result = PileupTestUtils.build_mapping_qualities_with_pysam(
            self.fn)
        # convert to chars
        pysam_result = [[chr(min(126, x + 33)) for x in l]
                        for l in pysam_result]

        self.assertEqual("".join(flatten_nested_list(pysam_result)),
                         "".join(flatten_nested_list(samtools_result)))
コード例 #3
0
def test_build_query_bases_with_reference_from_bam_with_samtoolspysam(benchmark):
    result = benchmark(build_query_bases_with_samtoolspysam,
                       os.path.join(BAM_DATADIR, "ex2.bam"),
                       "-f", os.path.join(BAM_DATADIR, "ex1.fa"))
    assert len("".join(flatten_nested_list(result))) == 115924
コード例 #4
0
def test_build_query_bases_with_reference_from_bam_with_pysam(benchmark):
    with pysam.FastaFile(os.path.join(BAM_DATADIR, "ex1.fa")) as fasta:
        result = benchmark(build_query_bases_with_pysam,
                           os.path.join(BAM_DATADIR, "ex2.bam"),
                           fastafile=fasta)
    assert len("".join(flatten_nested_list(result))) == 115924
コード例 #5
0
def test_build_query_bases_from_bam_with_pysam(benchmark):
    result = benchmark(build_query_bases_with_pysam,
                       os.path.join(BAM_DATADIR, "ex2.bam"))
    assert len("".join(flatten_nested_list(result))) == 116308
コード例 #6
0
def test_build_query_bases_from_bam_with_pysam_pileups(benchmark):
    # note that there is no overlap detection here
    result = benchmark(build_query_bases_with_pysam_pileups,
                       os.path.join(BAM_DATADIR, "ex2.bam"))
    assert len("".join(flatten_nested_list(result))) == 107241