althonos / althonos/pytrimal

Asterisks makes trimming fail

Offen
#8 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Cython
Sterne
27
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.