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

Bug in granges adjust without --sort #8

Open
vsbuffalo opened this issue May 16, 2024 · 0 comments
Open

Bug in granges adjust without --sort #8

vsbuffalo opened this issue May 16, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@vsbuffalo
Copy link
Owner

Issue is line 127 in src/commands.rs:

        // Create the parsing iterator, and detect which variant we need based on
        // column number of the first entry.
        let bedlike_iterator = BedlikeIterator::new(bedfile)?;

        // If we don't need to sort, use iterator-based streaming processing.
        for record in bedlike_iterator {
            let range = record?;
            let seqname = &range.seqname;
            let length = *genome
                .get(seqname)
                .ok_or(GRangesError::MissingSequence(seqname.to_string()))?;

            let possibly_adjusted_range = adjust_range(range, -both, both, length);

            if let Some(range_adjusted) = possibly_adjusted_range {
                writer.serialize(range_adjusted)?;
            } else {
                skipped_ranges += 1;
            }

            if skipped_ranges > 0 {
                report.add_issue(format!(
                    "{} ranges were removed because their widths after adjustment were ≤ 0",
                    skipped_ranges
                ))
            }

This uses BedlikeIterator which iterates through GenomicRangeRecord<U> entries. But BED3 are a special case, and need to be detected. The issue is that if not, the CSV crate's serialization routine will add an empty column. This section needs to be rewritten like the block below it, handing the BED3 special case.

@vsbuffalo vsbuffalo added bug Something isn't working good first issue Good for newcomers labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant