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

[Feature Request] Read from stdin option #48

Open
jolespin opened this issue Sep 2, 2022 · 3 comments
Open

[Feature Request] Read from stdin option #48

jolespin opened this issue Sep 2, 2022 · 3 comments

Comments

@jolespin
Copy link

jolespin commented Sep 2, 2022

It would be awesome if pyfastx could read from stdin for streaming purposes between programs.

import sys, pyfastx

def main():
    for id, seq in pyfastx.Fasta(sys.stdin, build_index=False):
        print(id)
if __name__ == "__main__":
    main()

Here's the error:

Traceback (most recent call last):
  File "/Users/jespinoz/test.py", line 7, in <module>
    main()
  File "/Users/jespinoz/test.py", line 4, in main
    for id, seq in pyfastx.Fasta(sys.stdin, build_index=False):
TypeError: a bytes-like object is required, not '_io.TextIOWrapper
@lmdu
Copy link
Owner

lmdu commented Nov 24, 2022

Thank you for your idea. But it will be complicated to implement this function due to the requirement of index building.

@bede
Copy link

bede commented May 22, 2023

This feature would be incredibly useful. You mention that building an index is required – but what about the case where build_index=False?

@lmdu
Copy link
Owner

lmdu commented May 26, 2023

I am so sorry. I could not find a good solution to resolve it. Because we use C language to implement the Fasta and Fastq parser class.

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

3 participants