コード例 #1
0
ファイル: test_crunchy.py プロジェクト: eriksjolund/cg
def test_is_cram_compression_done_no_cram(crunchy_config_dict, bam_path):
    """test cram_compression_done without created CRAM file"""
    # GIVEN a crunchy-api, and a bam_path
    crunchy_api = CrunchyAPI(crunchy_config_dict)

    # WHEN checking if cram compression is done
    result = crunchy_api.is_cram_compression_done(bam_path=bam_path)

    # THEN result should be false
    assert not result
コード例 #2
0
ファイル: test_crunchy.py プロジェクト: eriksjolund/cg
def test_is_cram_compression_done(crunchy_config_dict, compressed_bam):
    """Test cram_compression_done with created CRAM, CRAI, and flag files"""
    # GIVEN a crunchy-api, and a bam_path, cram_path, crai_path, and flag_path
    crunchy_api = CrunchyAPI(crunchy_config_dict)
    bam_path = compressed_bam

    # WHEN checking if cram compression is done
    result = crunchy_api.is_cram_compression_done(bam_path=bam_path)

    # THEN result should be True
    assert result
コード例 #3
0
ファイル: test_crunchy.py プロジェクト: eriksjolund/cg
def test_is_cram_compression_done_no_flag(crunchy_config_dict,
                                          compressed_bam_without_flag):
    """test cram_compression_done without created flag file"""
    # GIVEN a crunchy-api, and a bam_path, cram_path, crai_path
    crunchy_api = CrunchyAPI(crunchy_config_dict)
    bam_path = compressed_bam_without_flag

    # WHEN checking if cram compression is done
    result = crunchy_api.is_cram_compression_done(bam_path=bam_path)

    # THEN result should be False
    assert not result
コード例 #4
0
ファイル: test_crunchy.py プロジェクト: eriksjolund/cg
def test_cram_compression_before_after(crunchy_config_dict, crunchy_test_dir,
                                       mock_bam_to_cram, mocker):
    """Test cram_compression_done without before and after creating files"""
    # GIVEN a crunchy-api, and a bam_path
    bam_path = Path(crunchy_test_dir / "file.bam")
    mocker.patch.object(CrunchyAPI,
                        "bam_to_cram",
                        side_effect=mock_bam_to_cram)
    crunchy_api = CrunchyAPI(crunchy_config_dict)

    # WHEN calling cram_compression_done on bam_path
    result = crunchy_api.is_cram_compression_done(bam_path=bam_path)

    # Cram compression is not done
    assert not result

    # GIVEN created cram, crai, and flag paths
    crunchy_api.bam_to_cram(bam_path=bam_path, dry_run=False, ntasks=1, mem=2)

    # WHEN calling cram_compression_done on bam_path
    result = crunchy_api.is_cram_compression_done(bam_path=bam_path)

    # THEN compression is marked as done
    assert result