dinopy.input_opener module¶
- class dinopy.input_opener.InputOpener(source, native_io=False)¶
Open the input as an iterable over byte lines.
General opener for all input sources supported by dinopy. Assures that an iterable over the input is present as an Iterable over bytes objects (lines).
- Parameters:
source – sys.stdin, file_object (io.BufferedReader), list (of strings) or filepath (gzipped or plain file)
native_io (bool) – Use native, low level c calls where possible. Defaults to
True
. Only supports plain files at the moment.
Examples
Opening a file:
with InputOpener("filepath/file.fastq") as input_iter: for line in input_iter: magic(line)
Reading from stdin:
with InputOpener(sys.stdin) as input_iter: for line in input_iter: magic(line)