예제 #1
0
 def test_calmd_bam(self):
     ref_fpath = os.path.join(TEST_DATA_DIR, 'CUUC00007_TC01.fasta')
     bam_fpath = os.path.join(TEST_DATA_DIR, 'sample.bam')
     orig_qual = pysam.Samfile(bam_fpath).next().qual
     out_bam = NamedTemporaryFile()
     calmd_bam(bam_fpath, ref_fpath, out_bam.name)
     samfile = pysam.Samfile(out_bam.name)
     calmd_qual = alignment = samfile.next().qual
     assert orig_qual != calmd_qual
     assert calmd_qual == 'HHHHHHBHGGH!!!!!!!!!!!!!!!!!!!!!!!!!!!'
예제 #2
0
 def test_calmd_no_out(self):
     ref_fpath = os.path.join(TEST_DATA_DIR, 'CUUC00007_TC01.fasta')
     bam_fpath = os.path.join(TEST_DATA_DIR, 'sample.bam')
     copied_fpath = os.path.join(TEST_DATA_DIR, 'sample_copy.bam')
     try:
         shutil.copy(bam_fpath, copied_fpath)
         orig_stats = os.stat(copied_fpath)
         calmd_bam(copied_fpath, ref_fpath)
         calmd_stats = os.stat(copied_fpath)
         assert calmd_stats != orig_stats
     finally:
         if os.path.exists(copied_fpath):
             os.remove(copied_fpath)
예제 #3
0
 def test_calmd_no_out(self):
     ref_fpath = os.path.join(TEST_DATA_DIR, 'CUUC00007_TC01.fasta')
     bam_fpath = os.path.join(TEST_DATA_DIR, 'sample.bam')
     copied_fpath = os.path.join(TEST_DATA_DIR, 'sample_copy.bam')
     try:
         shutil.copy(bam_fpath, copied_fpath)
         orig_stats = os.stat(copied_fpath)
         calmd_bam(copied_fpath, ref_fpath)
         calmd_stats = os.stat(copied_fpath)
         assert calmd_stats != orig_stats
     finally:
         if os.path.exists(copied_fpath):
             os.remove(copied_fpath)
예제 #4
0
    def test_calmd_bam(self):
        ref_fpath = os.path.join(TEST_DATA_DIR, "CUUC00007_TC01.fasta")
        bam_fpath = os.path.join(TEST_DATA_DIR, "sample.bam")
        orig_qual = AlignmentFile(bam_fpath).next().qual
        try:
            out_bam = NamedTemporaryFile()
            calmd_bam(bam_fpath, ref_fpath, out_bam.name)

            samfile = AlignmentFile(out_bam.name)
            calmd_qual = samfile.next().qual
            assert orig_qual != calmd_qual
            assert calmd_qual == "HHHHHHBHGGH!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        finally:
            if os.path.exists(out_bam.name):
                out_bam.close()
예제 #5
0
    def test_calmd_bam(self):
        ref_fpath = os.path.join(TEST_DATA_DIR, 'CUUC00007_TC01.fasta')
        bam_fpath = os.path.join(TEST_DATA_DIR, 'sample.bam')
        orig_qual = AlignmentFile(bam_fpath).next().qual
        try:
            out_bam = NamedTemporaryFile()
            calmd_bam(bam_fpath, ref_fpath, out_bam.name)

            samfile = AlignmentFile(out_bam.name)
            calmd_qual = samfile.next().qual
            assert orig_qual != calmd_qual
            assert calmd_qual == 'HHHHHHBHGGH!!!!!!!!!!!!!!!!!!!!!!!!!!!'
        finally:
            if os.path.exists(out_bam.name):
                out_bam.close()