Skip to content

Commit

Permalink
fix vcf2beagle
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Sep 5, 2023
1 parent bb71527 commit dacbe6e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/vcf2beagle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ int main(int argc, char * argv[])
{
var.getFORMAT("PL", pl); // try get PL values
out.resize(pl.size());
for(size_t i = 0; i < pl.size(); i++) out[i] = std::pow(10, -pl[i] / 10);
for(size_t i = 0; i < pl.size(); i++) out[i] = std::pow(10, -(double)pl[i] / 10.0);
}
else if(tag == "GL")
{
var.getFORMAT("GL", gl); // try get GL values
out.resize(gl.size());
for(size_t i = 0; i < gl.size(); i++) out[i] = std::pow(10, gl[i]);
for(size_t i = 0; i < gl.size(); i++) out[i] = std::pow(10, (double)gl[i]);
}
else
{
throw runtime_error("please specify -t PL or GL\n");
}
// normalize it
line = var.CHROM() + "_" + to_string(var.POS()) + "\t" + var.REF() + "\t" + var.ALT();
for(int i = 0; i < nsamples; i++)
for(int i = 0; i < 3 * nsamples; i+=3)
{
double s = out[i] + out[i + 1] + out[i + 2];
out[i] /= s;
Expand Down

0 comments on commit dacbe6e

Please sign in to comment.