Skip to content

Commit

Permalink
Fix insertion bug
Browse files Browse the repository at this point in the history
- remove SNP information before inferred insertion bases
  • Loading branch information
chaklim committed Jan 16, 2020
1 parent d0f417c commit 3aab91a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clair/call_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ def inferred_insertion_bases_from(tensor_input):
for base_index in range(0, 4):
insertion_tensor[base_index] = insertion_tensor[base_index] + insertion_tensor[base_index + 4]
insertion_tensor[base_index + 4] = 0
insertion_tensor[base_index] -= (
tensor_input[position, base_index, Channel.SNP] + tensor_input[position, base_index + 4, Channel.SNP]
)

if (
position < (flanking_base_number + minimum_variant_length_that_need_infer) or
sum(insertion_tensor) >= inferred_indel_length_minimum_allele_frequency * sum(reference_tensor)
Expand Down Expand Up @@ -437,6 +441,10 @@ def insertion_bases_using_tensor(tensor_input, variant_length):
for base_index in range(0, 4):
insertion_tensor[base_index] = insertion_tensor[base_index] + insertion_tensor[base_index + 4]
insertion_tensor[base_index + 4] = 0
insertion_tensor[base_index] -= (
tensor_input[position, base_index, Channel.SNP] + tensor_input[position, base_index + 4, Channel.SNP]
)

insertion_bases += num2base[np.argmax(insertion_tensor) % 4]
return insertion_bases

Expand Down

0 comments on commit 3aab91a

Please sign in to comment.