[Feature Request] Read from stdin option
jolespin opened this issue · 3 comments
jolespin commented
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 commented
Thank you for your idea. But it will be complicated to implement this function due to the requirement of index building.
bede commented
This feature would be incredibly useful. You mention that building an index is required – but what about the case where build_index=False
?
lmdu commented
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.