Skip to content

Commit

Permalink
handle ambiguous subject sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
dorbarker committed Oct 16, 2019
1 parent 5f1679d commit dcf8470
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fsac/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ def extend_hit(gene, threshold: int, genome_path: Path):

else:

full_sequence = reverse_complement(contig[start : end])
try:
full_sequence = reverse_complement(contig[start : end])

except KeyError:
msg = 'Cannot assign allele due to ambiguous subject sequence'
logging.info(msg)
return None, None

logging.info('Extended hit to length %s, expected %s',
len(full_sequence), gene['QueryLength'])
len(full_sequence) - 1, gene['QueryLength'])
return full_sequence, None


Expand All @@ -123,7 +129,6 @@ def reverse_complement(sequence: str):
'T': 'A',
'G': 'C',
'C': 'G',
'N': 'N'
}

return ''.join(complements[x] for x in reversed(sequence))
Expand Down

0 comments on commit dcf8470

Please sign in to comment.