def test_parse_gene(): ## GIVEN gene line and header header = [ "hgnc_id", "hgnc_symbol", "disease_associated_transcripts", "reduced_penetrance", "genetic_disease_models", "mosaicism", "database_entry_version", ] hgnc_id = "10" hgnc_symbol = "hello" transcripts = "a,b,c" penetrance = "YES" models = "AR,AD" mosaicism = "" version = "" gene_line = [ hgnc_id, hgnc_symbol, transcripts, penetrance, models, mosaicism, version, ] gene_info = dict(zip(header, gene_line)) ## WHEN parsing the genes gene = parse_gene(gene_info) ## THEN assert that the gene is correctly parsed assert gene["hgnc_id"] == int(hgnc_id) assert gene["hgnc_symbol"] == hgnc_symbol assert gene["transcripts"] == transcripts.split(",") assert gene["inheritance_models"] == models.split(",") assert gene["reduced_penetrance"] is True if penetrance else False assert gene["mosaicism"] is False assert gene["database_entry_version"] == version ## WHEN alternative transcript index name gene_info.pop("disease_associated_transcripts") gene_info["disease_associated_transcript"] = transcripts ## THEN transcript asserts same gene = parse_gene(gene_info) assert gene["transcripts"] == transcripts.split(",") ## WHEN alternative transcript index name gene_info.pop("disease_associated_transcript") gene_info["transcripts"] = transcripts ## THEN transcript asserts same gene = parse_gene(gene_info) assert gene["transcripts"] == transcripts.split(",")
def test_parse_gene(): ## GIVEN gene line and header header = [ "hgnc_id", "hgnc_symbol", "disease_associated_transcripts", "reduced_penetrance", "genetic_disease_models", "mosaicism", "database_entry_version" ] hgnc_id = '10' hgnc_symbol = 'hello' transcripts = 'a,b,c' penetrance = 'YES' models = 'AR,AD' mosaicism = '' version = '' gene_line = [ hgnc_id, hgnc_symbol, transcripts, penetrance, models, mosaicism, version ] ## WHEN parsing the genes gene = parse_gene(gene_line, header) ## THEN assert that the gene is correctly parsed assert gene['hgnc_id'] == int(hgnc_id) assert gene['hgnc_symbol'] == hgnc_symbol.upper() assert gene['transcripts'] == transcripts.split(',') assert gene['inheritance_models'] == models.split(',') assert gene['reduced_penetrance'] == True if penetrance else False assert gene['mosaicism'] == False assert gene['database_entry_version'] == version
def test_parse_minimal_gene(): ## GIVEN minimal gene line and header header = ["hgnc_id"] gene_line = ["10"] ## WHEN parsing the genes gene = parse_gene(gene_line, header) ## THEN assert that the gene is correctly parsed assert gene['hgnc_id'] == 10
def test_parse_minimal_gene(): ## GIVEN minimal gene line and header header = ["hgnc_id"] gene_line = ["10"] gene_info = dict(zip(header, gene_line)) ## WHEN parsing the genes gene = parse_gene(gene_info) ## THEN assert that the gene is correctly parsed assert gene["hgnc_id"] == 10
def test_parse_minimal_gene(): ## GIVEN minimal gene line and header header = ["hgnc_id"] gene_line = ["10"] gene_info = dict(zip(header, gene_line)) ## WHEN parsing the genes gene = parse_gene(gene_info) ## THEN assert that the gene is correctly parsed assert gene['hgnc_id'] == 10
def test_parse_gene(): ## GIVEN gene line and header header = [ "hgnc_id", "hgnc_symbol", "disease_associated_transcripts", "reduced_penetrance", "genetic_disease_models", "mosaicism", "database_entry_version" ] hgnc_id = '10' hgnc_symbol = 'hello' transcripts = 'a,b,c' penetrance = 'YES' models = 'AR,AD' mosaicism = '' version = '' gene_line = [ hgnc_id, hgnc_symbol, transcripts, penetrance, models, mosaicism, version ] gene_info = dict(zip(header, gene_line)) ## WHEN parsing the genes gene = parse_gene(gene_info) ## THEN assert that the gene is correctly parsed assert gene['hgnc_id'] == int(hgnc_id) assert gene['hgnc_symbol'] == hgnc_symbol assert gene['transcripts'] == transcripts.split(',') assert gene['inheritance_models'] == models.split(',') assert gene['reduced_penetrance'] == True if penetrance else False assert gene['mosaicism'] == False assert gene['database_entry_version'] == version