pyfastx icon indicating copy to clipboard operation
pyfastx copied to clipboard

Iterating over sequences without comments results in comments from previous records

Open telatin opened this issue 2 years ago • 3 comments

Using pyfastx version 0.8.4, I tried iterating over records but the "comment" attribute is not reset. Is there a safer way to iterate (I would like not to assume FASTA format) or did I just miss something obvious?

File (test.fa):

>1 comment
TTTTTTTT
>3
atatat

Code:

import pyfastx
fa = pyfastx.Fastx("test.fa")
for name,seq,comment in fa:
    print(comment)

Output:

comment
comment

Thanks for your help

telatin avatar Dec 14 '21 11:12 telatin

Thank you for report this issue. But it was very strange. I have run your example on Windows and Ubuntu with Python 3.8.8 and pyfastx 0.8.4, the output of comment is right. Could you tell me your detailed system and python information.

lmdu avatar Dec 15 '21 01:12 lmdu

Thanks for the quick reply. I used PyFastx 0.8.4.

I tried both on Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31), [GCC 7.3.0] on linux under Ubuntu 16.04.4 LTS, in a Miniconda environment, where pyfastx was also added via conda.

I also tried locally, using Python 3.9.1 [Clang 10.0.0 ] on darwin, also via Miniconda, but under macOS Big Sur.

telatin avatar Dec 15 '21 09:12 telatin

I made a Dockerfile to test on a clean environment, see here

telatin avatar Dec 15 '21 10:12 telatin

We have fixed this issue in new versions >= 0.9.0

lmdu avatar Jan 01 '23 14:01 lmdu