コード例 #1
0
def test_vcf_reader_to_df(get_created_vcf_tabix_files):
    """Get all variants from parsed file into dataframe.
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_reader = VCFReader(vcf=vcf_file_path, bams=[], is_fp=False)
    df = vcf_reader.dataframe
    assert(len(vcf_reader) == len(df))
コード例 #2
0
ファイル: test_vcfio.py プロジェクト: rahulmohan/VariantWorks
def test_vcf_loader_snps(get_created_vcf_tabix_files):
    """Get all variants from mocked file stream, filter SNPs, multi allele & multi samples
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_bam_tuple = VCFReader.VcfBamPath(vcf=vcf_file_path, bam=tabix_file_path, is_fp=False)
    vcf_loader = VCFReader([vcf_bam_tuple])
    assert(len(vcf_loader) == 13)
コード例 #3
0
def test_vcf_load_variant_from_multiple_files(get_created_vcf_tabix_files):
    """Get variants from multiple mocked VCF files.
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_reader = VCFReader(vcf=vcf_file_path, bams=[], is_fp=False)
    vcf_reader_2x = VCFReader(vcf=vcf_file_path, bams=[], is_fp=False)
    assert (len(vcf_reader) == len(vcf_reader_2x))
コード例 #4
0
ファイル: test_vcfio.py プロジェクト: rahulmohan/VariantWorks
def test_vcf_load_fp(get_created_vcf_tabix_files):
    """Get first variant from false positive mocked VCF file stream and check zygosity.
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_bam_tuple = VCFReader.VcfBamPath(vcf=vcf_file_path, bam=tabix_file_path, is_fp=True)
    vcf_loader = VCFReader([vcf_bam_tuple])
    for v in vcf_loader:
        assert(v.zygosity == VariantZygosity.NO_VARIANT)
コード例 #5
0
def test_vcf_load_fp(get_created_vcf_tabix_files):
    """Get first variant from false positive mocked VCF file stream and check zygosity.
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_reader = VCFReader(vcf=vcf_file_path, bams=[], is_fp=True, format_keys=["GT"])
    for v in vcf_reader:
        for i in range(len(v.samples)):
            assert(v.zygosity[i] == VariantZygosity.NO_VARIANT)
コード例 #6
0
ファイル: test_vcfio.py プロジェクト: rahulmohan/VariantWorks
def test_vcf_load_variant_from_multiple_files(get_created_vcf_tabix_files):
    """Get variants from multiple mocked VCF files.
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    first_vcf_bam_tuple = VCFReader.VcfBamPath(vcf=vcf_file_path, bam=tabix_file_path, is_fp=False)
    second_vcf_bam_tuple = VCFReader.VcfBamPath(vcf=vcf_file_path, bam=tabix_file_path, is_fp=False)
    vcf_loader = VCFReader([first_vcf_bam_tuple])
    vcf_loader_2x = VCFReader([first_vcf_bam_tuple, second_vcf_bam_tuple])
    assert (2 * len(vcf_loader) == len(vcf_loader_2x))
コード例 #7
0
def test_vcf_fetch_variant(get_created_vcf_tabix_files):
    """Get first variant from mocked VCF file stream.
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_reader = VCFReader(vcf=vcf_file_path, bams=[], is_fp=False)
    try:
        assert (type(vcf_reader[0]) == Variant)
    except IndexError:
        pytest.fail("Can not retrieve first element from VCFReader")
コード例 #8
0
def test_vcf_reader(get_created_vcf_tabix_files):
    """Get all variants from mocked file stream, filter SNPs, multi allele & multi samples
    """
    vcf_file_path, tabix_file_path = get_created_vcf_tabix_files(mock_file_input())
    vcf_reader = VCFReader(vcf_file_path, bams=[], is_fp=False)
    assert(len(vcf_reader) == 17)
コード例 #9
0
ファイル: test_vcfio.py プロジェクト: tijyojwad/VariantWorks
 def new_vcf_reader_init(self, *args, **kargs):
     MockPyVCFReader.original_pyvcf_reader_init_function(
         self, mock_file_input())