Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

feat: allow parsing single ended RA files #247

Merged
merged 9 commits into from
May 29, 2024

Conversation

govinda-kamath
Copy link
Contributor

@govinda-kamath govinda-kamath commented May 24, 2024

No description provided.

Copy link
Contributor

@pmarks pmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach works -- just need to cache the flag rather than recompute it on every read.

src/read_pair_iter.rs Outdated Show resolved Hide resolved
@@ -352,6 +382,7 @@ impl ReadPairIter {
if self.buffer.remaining_mut() < 512 {
self.buffer = BytesMut::with_capacity(BUF_SIZE)
}
let is_single_ended = self.is_single_ended()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is inside the "inner loop" of FASTQ processing, so you can't be re-running the fairly heavy-weight is_single_ended function here -- it's too slow because it's opening files and parsing reads.

I thinkis_single_ended should be a pre-computed flag that is set when you construct the ReadPairIter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. This had made the iterations 100x slower on testing (DETECT_CHEMISTRY that usually takes <5 min had run overnight for something like 8hours when I was testing).

@@ -322,6 +322,36 @@ impl ReadPairIter {
})
}

pub fn is_single_ended(&self) -> Result<bool, FastqError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return the value of a flag stored in the struct. THere should probably be a non-public method that computes this once at the time you create the ReadPairIter

Copy link
Contributor Author

@govinda-kamath govinda-kamath May 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@pmarks pmarks merged commit 4e059b2 into master May 29, 2024
1 check passed
@pmarks pmarks deleted the gmk/allow-single-ended-reads branch May 29, 2024 17:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants