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

Support querying for SAM/GTF/GFF records #158

Closed
claymcleod opened this issue Mar 28, 2023 · 1 comment
Closed

Support querying for SAM/GTF/GFF records #158

claymcleod opened this issue Mar 28, 2023 · 1 comment
Assignees
Labels
csi enhancement New feature or request gff gtf

Comments

@claymcleod
Copy link
Contributor

Currently, noodles::sam::Reader.records(), noodles::gff::Reader.records(), and noodles::gtf::Reader.records() do not support querying of noodles::core::region::Regions like BAM and CRAM do. I'm intuiting the reason why is because they do not have the specialized indexes like BAM/CRAM do. However, it would be really nice for noodles to provide the functionality of querying a region for these files, even if it required making some generic index for the files before querying.

Required for stjude-rust-labs/ngs#18 and stjude-rust-labs/ngs#19.

@zaeleus zaeleus self-assigned this May 11, 2023
@zaeleus zaeleus added gff csi gtf enhancement New feature or request labels May 11, 2023
@zaeleus
Copy link
Owner

zaeleus commented May 18, 2023

noodles 0.25.0/noodles-sam 0.17.0 (2022-07-05) introduced a query iterator to query SAM (sam::Reader::query).

noodles 0.39.0/noodles-gff 0.12.0/noodles-gtf 0.10.0 (2023-05-18) now have query iterators to query GFF (gff::Reader::query) and GTF (gtf::Reader::query).

noodles 0.39.0/noodles-csi 0.18.0 (2023-05-18) also has a generic indexed record parser (IndexedRecords) and filter (FilterByRegion).

let records = Query::new(&mut decoder, chunks)
    .indexed_records(&header)
    .filter_by_region(&region);

for result in records {
    let record = result?;
    // ...
}

This pattern is wrapped by tabix::io::IndexedReader.

let reader = tabix::io::IndexedReader::new(inner, index);
for result in reader.query(&region) {
    let record = result?;
    // ...
}

@zaeleus zaeleus closed this as completed May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csi enhancement New feature or request gff gtf
Projects
None yet
Development

No branches or pull requests

2 participants