Asterisks makes trimming fail
- Lingua principale
- Cython
- Stelle
- 27
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
It seems that having asterisks in my fasta files cause the AutomaticTrimmer to fail when running on strict/automated1 modes. I included a minimal example of code with an attached file of sequences. Pytrimal version 0.8.5 installed through pip.
```
def parse_fasta(path: str=None):
path = path or self.seq_path
for r in SeqIO.parse(path, "fasta"):
id, seq = r.id, str(r.seq)
yield id, seq
def align(path: str):
sequences = [
pyfamsa.Sequence(id.encode(), seq.encode()) for id, seq in self.parse_fasta(path)
]
aligner = pyfamsa.Aligner(guide_tree="upgma")
alignment = aligner.align(sequences)
msa = pytrimal.Alignment(
names=[row.id for row in alignment],
sequences=[row.sequence.decode() for row in alignment]
)
return msa
def trim(msa, method="strict"):
trimmer = pytrimal.AutomaticTrimmer(method=method)
trimmed = trimmer.trim(msa)
return trimmed
trim(align("test_file.fasta"))
```
```
Traceback (most recent call last):
File "/alignment/trim.py", line 152, in
trim = hmm.trim(align)
File "/alignment/trim.py", line 104, in trim
trimmed = trimmer.trim(msa)
File "pytrimal/_trimal.pyx", line 1291, in pytrimal._trimal.BaseTrimmer.trim
File "pytrimal/_trimal.pyx", line 1355, in pytrimal._trimal.BaseTrimmer.trim
ValueError: the symbol '*' is incorrect
```
[test_file.fasta.gz](https://github.com/user-attachments/files/27380716/test_file.fasta.gz)
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.