Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iteration on record? #3

Closed
fmarletaz opened this issue Dec 5, 2019 · 1 comment
Closed

iteration on record? #3

fmarletaz opened this issue Dec 5, 2019 · 1 comment

Comments

@fmarletaz
Copy link

Thanks for developing pyfastx, that's a really nice tool! However, I have a basic question. When you iterate over the fasta object or the pyfastx.Fasta(command, does it always report name and sequences as string. What if I want to iterate over sequence objects to rename them using the description field. Maybe I missed something. Thanks again!!!

@lmdu
Copy link
Owner

lmdu commented Dec 5, 2019

Yes, current version for fasta object iteration can only return a tuple with string of name and seq. But you can use keys for iteration to make a sequence object for additional information. For example:

fa = pyfastx.Fasta('your_fasta.fa')
for name in fa.keys():
    s = fa[name]
    print(s.description)

In future version, iteration for sequence object from fasta object will be added.

@lmdu lmdu closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants