Skip to content

Commit

Permalink
the MGE FASTA files seem to have developed underscores as some magic …
Browse files Browse the repository at this point in the history
…sequence character :-/
  • Loading branch information
rvosa committed Nov 25, 2024
1 parent 9e58150 commit 7e88f7d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions barcode_validator/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ def unalign_sequence(self, sequence):
self.logger.info("Removing gaps from aligned sequence")
if isinstance(sequence, SeqRecord):
# Convert Seq to string, remove gaps, then convert back to Seq
unaligned_sequence = str(sequence.seq).replace('-', '').replace('~', '')
unaligned_sequence = str(sequence.seq).replace('-', '').replace('~', '').replace('_', '')
sequence.seq = Seq(unaligned_sequence)
return sequence
elif isinstance(sequence, Seq):
# If it's just a Seq object, convert to string, remove gaps, then back to Seq
return Seq(str(sequence).replace('-', '').replace('~', ''))
return Seq(str(sequence).replace('-', '').replace('~', '').replace('_', ''))
elif isinstance(sequence, str):
# If it's a string, just remove the gaps
return sequence.replace('-', '').replace('~', '')
return sequence.replace('-', '').replace('~', '').replace('_', '')
else:
raise TypeError(f"Unexpected type for sequence: {type(sequence)}")

Expand Down

0 comments on commit 7e88f7d

Please sign in to comment.