Skip to content

Commit

Permalink
added a boundary condition for normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
atks committed Sep 10, 2014
1 parent facdd1f commit 47df3e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion normalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Igor : Program
uint32_t pos1 = bcf_get_pos1(v);

std::vector<std::string> alleles;
for (uint32_t i=0; i<bcf_get_n_allele(v); ++i)
for (size_t i=0; i<bcf_get_n_allele(v); ++i)
{
char *s = bcf_get_alt(v, i);
while (*s)
Expand Down
1 change: 0 additions & 1 deletion variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ int32_t Variant::classify_variant(const char* chrom, uint32_t pos1, char** allel
alt = ALT.s;
}


int32_t mlen = std::min(rl, al);
int32_t dlen = al-rl;
int32_t diff = 0;
Expand Down
8 changes: 7 additions & 1 deletion variant_manip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@ void VariantManip::right_trim_or_left_extend(std::vector<std::string>& alleles,
to_right_trim = false;
//do not break here!!! you need to check for empty alleles that might exist!!!
}

if (pos1==1 && alleles[i].size()==1)
{
to_right_trim = false;
break;
}
}
else
{
Expand All @@ -502,7 +508,7 @@ void VariantManip::right_trim_or_left_extend(std::vector<std::string>& alleles,
break;
}
}

if (to_right_trim)
{
for (size_t i=0; i<alleles.size(); ++i)
Expand Down

0 comments on commit 47df3e8

Please sign in to comment.