althonos / althonos/pytrimal

Asterisks makes trimming fail

Abierto
#8 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Cython
Estrellas
27
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.