Skip to content

Commit

Permalink
Merge pull request #6 from marikaris/fix/history-for-indels
Browse files Browse the repository at this point in the history
fix(consensusfilegenerator): add history for indels after fix on data-transform-vkgl
  • Loading branch information
bartcharbon authored Sep 3, 2020
2 parents 2610c8e + fa03f4c commit af2d2ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
20 changes: 20 additions & 0 deletions consensus/ConsensusFileGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@ def _get_history_ids_for_variant(variant_id, chromosome, position, ref, alt, gen
old_alt = alt[1::]
old_id_del_ins = '{}_{}_{}_{}_{}'.format(chromosome, position, old_ref, old_alt, gene)
ids.append(old_id_del_ins)
elif variant_type == "delins":
# ids for indels when this was still an issue https://github.com/molgenis/data-transform-vkgl/issues/12
old_pos = str(int(position) - 1)
old_ref1 = "A" + ref
old_alt1 = "A" + alt
old_id1 = Hasher.hash(chromosome + '_' + old_pos + '_' + old_ref1 + '_' + old_alt1 + '_' + gene)[0:10]
old_ref2 = "G" + ref
old_alt2 = "G" + alt
old_id2 = Hasher.hash(chromosome + '_' + old_pos + '_' + old_ref2 + '_' + old_alt2 + '_' + gene)[0:10]
old_ref3 = "T" + ref
old_alt3 = "T" + alt
old_id3 = Hasher.hash(chromosome + '_' + old_pos + '_' + old_ref3 + '_' + old_alt3 + '_' + gene)[0:10]
old_ref4 = "C" + ref
old_alt4 = "C" + alt
old_id4 = Hasher.hash(chromosome + '_' + old_pos + '_' + old_ref4 + '_' + old_alt4 + '_' + gene)[0:10]
ids.append(old_id1)
ids.append(old_id2)
ids.append(old_id3)
ids.append(old_id4)

return ids

def _get_matching_history(self, variant):
Expand Down
6 changes: 5 additions & 1 deletion tests/ConsensusFileGenerator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def test__get_lab_classification(self):
('ins',
{'variant_id': '609ab27375', 'chromosome': '3', 'pos': '38627166', 'gene': 'SCN5A', 'ref': 'C',
'alt': 'CGTGTGTGTGTGTGG', 'variant_type': 'ins'},
['609ab27375', '3_38627166_C_CGTGTGTGTGTGTGG_SCN5A', '3_38627166_._GTGTGTGTGTGTGG_SCN5A'])
['609ab27375', '3_38627166_C_CGTGTGTGTGTGTGG_SCN5A', '3_38627166_._GTGTGTGTGTGTGG_SCN5A']),
('delins',
{'variant_id': '3e69715481', 'chromosome': '9', 'pos': '135786871', 'gene': 'TSC1', 'ref': 'GGGGAACTCAGAGT',
'alt': 'AACTGC', 'variant_type': 'delins'},
['3e69715481', '9_135786871_GGGGAACTCAGAGT_AACTGC_TSC1', '4dd6e4fad5', '4b70f6a705', 'ae3fae1fd2', 'c3d04968bc'])
])
def test__get_history_ids_for_variant(self, _, variant_info, expected):
variant_id = variant_info['variant_id']
Expand Down

0 comments on commit af2d2ba

Please sign in to comment.