def test_CSQ(): """Test to get the raw chromosome""" plugin = Plugin(name='CSQ', field='INFO', info_key="CSQ", csq_key="Gene", separators=['&']) variant_line = get_variant_line() variant_dict = get_variant_dict() test_value = ['ENSG00000138378', 'ENSG00000138378'] assert plugin.get_entry(variant_line=variant_line, csq_format=csq_format) == test_value assert plugin.get_entry(variant_dict=variant_dict, csq_format=csq_format) == test_value
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_entry(variant_line=variant_line) == [ref] assert plugin.get_entry(variant_dict=variant_dict) == [ref]
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_entry(variant_line=variant_line) == [alt] assert plugin.get_entry(variant_dict=variant_dict) == [alt]
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_entry(variant_line=variant_line) == [db_id] assert plugin.get_entry(variant_dict=variant_dict) == [db_id]
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_entry(variant_line=variant_line) == [test_pos] assert plugin.get_entry(variant_dict=variant_dict) == [test_pos]
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_entry(variant_line=variant_line) == [filt] assert plugin.get_entry(variant_dict=variant_dict) == [filt]
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_entry(variant_line=variant_line) == [test_chrom] assert plugin.get_entry(variant_dict=variant_dict) == [test_chrom]
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_entry(variant_line=variant_line) == [qual] assert plugin.get_entry(variant_dict=variant_dict) == [qual]
def test_non_existing(): """Test to get the raw chromosome""" plugin = Plugin(name='non_existing', field='INFO', info_key="non", separators=[',']) variant_line = get_variant_line() variant_dict = get_variant_dict() assert plugin.get_entry(variant_line=variant_line) == [] assert plugin.get_entry(variant_dict=variant_dict) == []
def test_1000G(): """Test to get the raw chromosome""" plugin = Plugin(name='thousand_g', field='INFO', info_key="1000GAF", separators=[',']) test_value = '0.744609' variant_line = get_variant_line() variant_dict = get_variant_dict() assert plugin.get_entry(variant_line=variant_line) == [test_value] assert plugin.get_entry(variant_dict=variant_dict) == [test_value]
def test_CLNSIG(): """Test to get the raw chromosome""" plugin = Plugin(name='Clnsig', field='INFO', info_key="CLNSIG", separators=[',']) test_value = ['255','10'] variant_line = get_variant_line() variant_dict = get_variant_dict() assert plugin.get_entry(variant_line=variant_line) == test_value assert plugin.get_entry(variant_dict=variant_dict) == test_value
def test_multiple_id(): """Test to get the raw chromosome""" plugin = Plugin(name='ID', field='ID') db_id_1 = 'rs001' db_id_2 = 'rs002' db_id = "{0};{1}".format(db_id_1, db_id_2) variant_line = get_variant_line(db_id=db_id) variant_dict = get_variant_dict(db_id=db_id) assert plugin.get_entry(variant_line=variant_line) == [db_id_1, db_id_2] assert plugin.get_entry(variant_dict=variant_dict) == [db_id_1, db_id_2]
def test_multiple_alt(): """Test to get the raw chromosome""" plugin = Plugin(name='alt', field='ALT') alt_1 = 'A' alt_2 = 'T' alt = "{0},{1}".format(alt_1, alt_2) variant_line = get_variant_line(alt=alt) variant_dict = get_variant_dict(alt=alt) assert plugin.get_entry(variant_line=variant_line) == [alt_1, alt_2] assert plugin.get_entry(variant_dict=variant_dict) == [alt_1, alt_2]
def test_multiple_filter(): """Test to get the raw chromosome""" plugin = Plugin(name='Filter', field='FILTER') filt_1 = 'PASS' filt_2 = 'low_qual' filt = "{0};{1}".format(filt_1, filt_2) variant_line = get_variant_line(filt=filt) variant_dict = get_variant_dict(filt=filt) assert plugin.get_entry(variant_line=variant_line) == [filt_1, filt_2] assert plugin.get_entry(variant_dict=variant_dict) == [filt_1, filt_2]
def test_CLNSIG(): """Test to get the raw chromosome""" plugin = Plugin(name='Clnsig', field='INFO', info_key="CLNSIG", separators=[',']) test_value = ['255', '10'] variant_line = get_variant_line() variant_dict = get_variant_dict() assert plugin.get_entry(variant_line=variant_line) == test_value assert plugin.get_entry(variant_dict=variant_dict) == test_value
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_entry( variant_dict=variant_dict, dict_key='1' ) line_entry = plugin.get_entry( variant_line=variant_line, dict_key='1' ) assert dict_entry == ['12'] assert line_entry == ['12']
def test_CSQ(): """Test to get the raw chromosome""" plugin = Plugin(name='CSQ', field='INFO', info_key="CSQ", csq_key="Gene", separators=['&']) variant_line = get_variant_line() variant_dict = get_variant_dict() test_value = [ 'ENSG00000138378', 'ENSG00000138378' ] assert plugin.get_entry(variant_line=variant_line, csq_format=csq_format) == test_value assert plugin.get_entry(variant_dict=variant_dict, csq_format=csq_format) == test_value
def test_dict_two_separators_no_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_entry(variant_dict=variant_dict) line_entry = plugin.get_entry(variant_line=variant_line) assert dict_entry == ['11'] assert line_entry == ['11']
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_entry( variant_dict=variant_dict, dict_key='1' ) line_entry = plugin.get_entry( variant_line=variant_line, dict_key='1' ) assert dict_entry == ['AD','AD_dn'] assert line_entry == ['AD','AD_dn']
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_entry(variant_dict=variant_dict, dict_key='1') line_entry = plugin.get_entry(variant_line=variant_line, dict_key='1') assert dict_entry == ['AD', 'AD_dn'] assert line_entry == ['AD', 'AD_dn']