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

fix: pretty print with suffix xclip or yclip #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dcroote
Copy link
Contributor

@dcroote dcroote commented Jul 14, 2023

Closes #47.

Thanks @kwuiee, what you identified definitely looks like a bug to me. When running your test:

    fn test_pretty_suffix_xclip_or_yclip() {
        let alignment = Alignment {
            score: -7,
            ystart: 1,
            xstart: 0,
            yend: 4,
            xend: 3,
            ylen: 4,
            xlen: 4,
            operations: vec![Yclip(1), Match, Match, Match, Xclip(1)],
            mode: AlignmentMode::Custom,
        };
        let pretty = concat!(" TCGC\n ||| \nATCG \n\n\n");
        assert_eq!(alignment.pretty(b"TCGC", b"ATCG", 100), pretty);
    }

on the existing code it fails, producing the following output:

running 1 test
thread 'alignment::tests::test_pretty_suffix_xclip_or_yclip' panicked at 'assertion failed: `(left == right)`
  left: `" TCGT\n ||| \nATCG \n\n\n"`,
 right: `" TCGC\n ||| \nATCG \n\n\n"`', src/alignment.rs:557:9

Clearly there is a bug because the left sequence is wrong (terminal T where it should be C).

I've incorporated your test and fix in this PR.

@dcroote dcroote requested a review from dlaehnemann July 14, 2023 04:05
@coveralls
Copy link

Pull Request Test Coverage Report for Build 5550351717

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 5 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.06%) to 63.539%

Files with Coverage Reduction New Missed Lines %
src/annot/contig.rs 1 55.75%
src/annot/pos.rs 1 51.43%
src/annot/spliced.rs 1 68.6%
src/genome.rs 2 0%
Totals Coverage Status
Change from base Build 5529481215: 0.06%
Covered Lines: 474
Relevant Lines: 746

💛 - Coveralls

@@ -259,7 +259,7 @@ impl Alignment {
y_pretty.push('-');
}
AlignmentOperation::Xclip(len) => {
for k in x.iter().take(len) {
for k in x.iter().skip(x_i).take(len) {
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this doesn't break non-Custom Alignments? Or maybe to be clearer, is there either (i) a test case that also covers this for for some non-custom Alignment? I could imagine, that the special casing further up is the actual problem? But you dug into this code in more detail, so are probably more confident in answering those question.

Copy link
Member

Choose a reason for hiding this comment

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

@dcroote Will you have time to have another look here? Otherwise I would probably move ahead with release 1.0.1 at #62 for now...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the delay- I'll need more time to flesh out the test cases so feel free to move ahead with the release

Copy link
Member

Choose a reason for hiding this comment

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

Just a quick ping to see if there is any planned activity, here. If so, feel free to update the branch, first.

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 this pull request may close these issues.

Error prettry print suffix xclip or yclip
3 participants