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

Two_headers should be a SequenceRecord attribute #38

Open
rhpvorderman opened this issue Feb 4, 2022 · 2 comments
Open

Two_headers should be a SequenceRecord attribute #38

rhpvorderman opened this issue Feb 4, 2022 · 2 comments

Comments

@rhpvorderman
Copy link
Collaborator

Currently dnaio uses a slightly unusual architecure where the first value of fastq_iter is a boolean, not a SequenceRecord. This determines whether all coming fastq headers are printed with two headers. FastqWriter has a rather quirky implementation to determine its write method.

I think this can be best solved by having a boolean attribute to each sequencerecord. This can be set instantly without branching (no if statement). We can then add a fastq_bytes_as_input method, which will print one or two headers based on the boolean attribute. The fastq_bytes_as_input method can then be used by the FastqWriter class.

This will be fairly trivial to implement once the C-code PR is merged.

@rhpvorderman
Copy link
Collaborator Author

I have been thinking a bit about this. FastqWriter could also simply use the boolean flag that is part of fastq_bytes. That would make it a lot simpler.

As for determining two_headers, it might be better to factor this out of FastqIter altogether and instead write a python method that relies on peek.

@rhpvorderman
Copy link
Collaborator Author

rhpvorderman commented Feb 15, 2022

I tried factoring the two header system out of FastqIter altogether, but it is impossible to determine the two_header status outside that loop if the file cannot be seeked and reads are longer than the size of io.BufferedReader's buffer. (When reading from stdin or a pipe).

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

Successfully merging a pull request may close this issue.

1 participant