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 a bug in breakend detection #1858

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/test-bcf_set_variant_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ static void test_bcf_set_variant_type(void)
{
error("[16:33625444[N was not detected as a breakend");
}

bcf_set_variant_type("T", "]chrB:123]AGTNNNNNCAT", &var3d);
if ( var3d.type != VCF_BND)
{
error("]chrB:123]AGTNNNNNCAT was not detected as a breakend");
}
bcf_set_variant_type("C", "CAGTNNNNNCA[chrA:321[", &var3d);
if ( var3d.type != VCF_BND)
{
error("CAGTNNNNNCA[chrA:321[ was not detected as a breakend");
}


// Test special reference alleles
bcf_variant_t var4a;
bcf_set_variant_type("A", "<NON_REF>", &var4a);
Expand Down
2 changes: 1 addition & 1 deletion vcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -5025,8 +5025,8 @@ static void bcf_set_variant_type(const char *ref, const char *alt, bcf_variant_t

if ( *a && !*r )
{
if ( *a==']' || *a=='[' ) { var->type = VCF_BND; return; } // "joined after" breakend
while ( *a ) a++;
if ( *(a-1)==']' || *(a-1)=='[' ) { var->type = VCF_BND; return; } // "joined after" breakend
var->n = (a-alt)-(r-ref); var->type = VCF_INDEL | VCF_INS; return;
}
else if ( *r && !*a )
Expand Down