This PR closes #199 (I hope). As described in the issue, various longbow commands were failing when reading from stdin. This PR changes load_model() to expect an open pysam.AlignmentFile rather than a stream or filename, and moves the call inside the with statement where the file is being read (which is almost always what happens immediately after loading a model from a BAM file).
This should be okay to do, as the model is stored in the header if at all, and so load_model will only consume the first piece of the stream and none of the reads.
This PR closes #199 (I hope). As described in the issue, various longbow commands were failing when reading from
stdin
. This PR changesload_model()
to expect an openpysam.AlignmentFile
rather than a stream or filename, and moves the call inside thewith
statement where the file is being read (which is almost always what happens immediately after loading a model from a BAM file).This should be okay to do, as the model is stored in the header if at all, and so
load_model
will only consume the first piece of the stream and none of the reads.