예제 #1
0
def test_gt_call_no_header():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='gt_call', field='sample_id', gt_key='GT')
    variant_line = get_variant_line()
    
    with pytest.raises(IOError):
        plugin.get_raw_entry(variant_line=variant_line, individual_id='ADM1003A3')
예제 #2
0
def test_gt_call_no_individual():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='gt_call', field='sample_id', gt_key='GT')
    vcf_header = ['CHROM', 'POS', 'ID', 'REF', 'ALT', 'QUAL', 'FILTER', 'INFO', 'FORMAT', 'ADM1003A3']
    variant_line = get_variant_line()
    variant_dict = get_variant_dict()

    with pytest.raises(IOError):
        plugin.get_raw_entry(variant_line=variant_line, vcf_header=vcf_header)

    with pytest.raises(IOError):
        plugin.get_raw_entry(variant_dict=variant_dict, vcf_header=vcf_header)
예제 #3
0
def test_id():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='ID', field='ID')
    db_id = 'rs001'
    variant_line = get_variant_line(db_id=db_id)
    variant_dict = get_variant_dict(db_id=db_id)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == db_id
    assert plugin.get_raw_entry(variant_dict=variant_dict) == db_id
예제 #4
0
def test_pos():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='Pos', field='POS')
    test_pos = '1000'
    variant_line = get_variant_line(pos=test_pos)
    variant_dict = get_variant_dict(pos=test_pos)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == test_pos
    assert plugin.get_raw_entry(variant_dict=variant_dict) == test_pos
예제 #5
0
def test_chrom():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='Chrom', field='CHROM')
    test_chrom = '10'
    variant_line = get_variant_line(chrom=test_chrom)
    variant_dict = get_variant_dict(chrom=test_chrom)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == test_chrom
    assert plugin.get_raw_entry(variant_dict=variant_dict) == test_chrom
예제 #6
0
def test_gt_call():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='gt_call', field='sample_id', gt_key='GT')
    
    vcf_header = ['CHROM', 'POS', 'ID', 'REF', 'ALT', 'QUAL', 'FILTER', 'INFO', 'FORMAT', 'ADM1003A3']
    
    variant_line = get_variant_line()
    variant_dict = get_variant_dict()
    
    assert plugin.get_raw_entry(
        variant_line=variant_line, 
        vcf_header=vcf_header, 
        individual_id='ADM1003A3') == '1/1'

    assert plugin.get_raw_entry(
        variant_dict=variant_dict, 
        vcf_header=vcf_header, 
        individual_id='ADM1003A3') == '1/1'
예제 #7
0
def test_CLNSIG():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='Clnsig', field='INFO', info_key="CLNSIG")
    test_value = '255,10'
    variant_line = get_variant_line()
    variant_dict = get_variant_dict()
    
    assert plugin.get_raw_entry(variant_line=variant_line) == test_value
    assert plugin.get_raw_entry(variant_dict=variant_dict) == test_value
예제 #8
0
def test_format():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='Format', field='FORMAT')
    form = 'GT:AD:GQ:PL'
    variant_line = get_variant_line(form=form)
    variant_dict = get_variant_dict(form=form)

    assert plugin.get_raw_entry(variant_line=variant_line) == form
    assert plugin.get_raw_entry(variant_dict=variant_dict) == form
예제 #9
0
def test_filter():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='Filter', field='FILTER')
    filt = 'PASS'
    variant_line = get_variant_line(filt=filt)
    variant_dict = get_variant_dict(filt=filt)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == filt
    assert plugin.get_raw_entry(variant_dict=variant_dict) == filt
예제 #10
0
def test_qual():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='QUAL', field='QUAL')
    qual = '1234.5'
    variant_line = get_variant_line(qual=qual)
    variant_dict = get_variant_dict(qual=qual)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == qual
    assert plugin.get_raw_entry(variant_dict=variant_dict) == qual
예제 #11
0
def test_alt():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='alt', field='ALT')
    alt = 'A'
    variant_line = get_variant_line(alt=alt)
    variant_dict = get_variant_dict(alt=alt)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == alt
    assert plugin.get_raw_entry(variant_dict=variant_dict) == alt
예제 #12
0
def test_ref():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='ref', field='REF')
    ref = 'rs001'
    variant_line = get_variant_line(ref=ref)
    variant_dict = get_variant_dict(ref=ref)
    
    assert plugin.get_raw_entry(variant_line=variant_line) == ref
    assert plugin.get_raw_entry(variant_dict=variant_dict) == ref
예제 #13
0
def test_1000G():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='thousand_g', field='INFO', info_key="1000GAF")
    variant_line = get_variant_line()
    variant_dict = get_variant_dict()
    
    test_value = '0.744609'
    
    assert plugin.get_raw_entry(variant_line=variant_line) == test_value
    assert plugin.get_raw_entry(variant_dict=variant_dict) == test_value
예제 #14
0
def test_dict_two_separators_with_key():
    """Test to get the raw chromosome"""
    variant_dict = get_variant_dict(info="RankScore=1:12,2:11")
    variant_line = get_variant_line(info="RankScore=1:12,2:11")
    
    plugin = Plugin(
        name='rank_score', 
        field='INFO', 
        info_key="RankScore", 
        separators=[',', ':'],
        dict_entry=True
    )
    dict_entry = plugin.get_raw_entry(
        variant_dict=variant_dict,
        dict_key='1'
    )
    line_entry = plugin.get_raw_entry(
        variant_line=variant_line,
        dict_key='1'
    )
    
    assert dict_entry == '12'
    assert line_entry == '12'
예제 #15
0
def test_dict_three_separators_with_key():
    """Test to get the raw chromosome"""
    variant_dict = get_variant_dict(info="GeneticModels=1:AD|AD_dn,2:AR_hom")
    variant_line = get_variant_line(info="GeneticModels=1:AD|AD_dn,2:AR_hom")
    
    plugin = Plugin(
        name='genetic_models',
        field='INFO',
        info_key="GeneticModels",
        separators=[',', ':', '|'],
        dict_entry=True
    )

    dict_entry = plugin.get_raw_entry(
        variant_dict=variant_dict,
        dict_key='1'
    )
    line_entry = plugin.get_raw_entry(
        variant_line=variant_line,
        dict_key='1'
    )

    assert dict_entry == 'AD|AD_dn'
    assert line_entry == 'AD|AD_dn'
예제 #16
0
def test_gt_call_no_header_dict():
    """Test to get the raw chromosome"""
    plugin = Plugin(name='gt_call', field='sample_id', gt_key='GT')
    variant_dict = get_variant_dict()
    
    assert plugin.get_raw_entry(variant_dict=variant_dict, individual_id='ADM1003A3') == '1/1'