Commit a83e89b3 authored by Venkat Malladi's avatar Venkat Malladi
Browse files

Fix IHC and sequening for database.

parent 2d66e0c7
......@@ -64,6 +64,19 @@ def convert_number(merged, significance):
return merged
def reformat_gene(merged):
'''Converts gene names to apporpriate string for database'''
merged['Gene'] = merged['Gene'].astype(str) + '(Sequencing)'
# If IHC then switch
pat = r"^IHC(?P<one>\w+)\((Sequencing\))"
repl = lambda m: m.group('one') + '(IHC)'
merged.Gene = merged.Gene.str.replace(pat, repl, regex=True)
return merged
def calculate_shift(cancer_gene, date_shift):
'''Shift Date for start date'''
......@@ -117,8 +130,11 @@ def main():
# Convert missing Number
fix_number = convert_number(cancer_gene_reformat, significance_map)
# Convert gene names
fix_gene = reformat_gene(fix_number)
# Calculate Date Shift
shifted_df = calculate_shift(fix_number, date_shift)
shifted_df = calculate_shift(fix_gene, date_shift)
# Write out radiation table
shifted_df.to_csv(cancer_gene_table, index=False)
......
......@@ -112,3 +112,11 @@ def test_check_convert_number_5(germline_5, significance_map):
converted_germline = transform_germline_mutations.convert_number(transform_germline, significance_map)
row_selection = converted_germline[converted_germline['Gene'] == 'SDHC'].index.item()
assert converted_germline.loc[row_selection, 'Number'] == 'Pending'
@pytest.mark.unit
def test_check_reformat_gene(germline_5):
transform_germline = transform_germline_mutations.reformat_record(germline_5)
converted_germline = transform_germline_mutations.reformat_gene(transform_germline)
row_selection = converted_germline[converted_germline['Gene'].str.match(r'SDHC')==True].index.item()
assert converted_germline.loc[row_selection, 'Gene'] == 'SDHC(Sequencing)'
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment