Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Feb 8, 2024
1 parent 6dd9341 commit 834fbfe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/admixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,24 +162,26 @@ void Admixture::protectPars()
}

if(F.isNaN().any()) cao.error("NaN in F\n");
if(!cF)
if(cF)
{
constrainF();
}
else
{
F = (F < clusterFreqThreshold).select(clusterFreqThreshold, F); // lower bound
F = (F > 1 - clusterFreqThreshold).select(1 - clusterFreqThreshold, F); // upper bound
for(int k = 0; k < K; k++) F.middleRows(k * C, C).rowwise() /= F.middleRows(k * C, C).colwise().sum();
}
constrainF();
}

// need to fix the cluster ordering
void Admixture::constrainF()
{
for(int k = 0; k < K; k++)
{
if(cF)
{
for(int c = 0; c < C; c++)
for(int g = 0; g < G; g++)
if(F(k * C + c, g) < P(c, g)) F(k * C + c, g) = P(c, g);
}
for(int c = 0; c < C; c++)
for(int g = 0; g < G; g++)
if(F(k * C + c, g) < P(c, g)) F(k * C + c, g) = P(c, g);
F.middleRows(k * C, C).rowwise() /= F.middleRows(k * C, C).colwise().sum();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main(int argc, char * argv[])
{
// ========= helper message and parameters parsing ===========================

const std::string VERSION{"0.5.0"};
const std::string VERSION{"0.5.1"};

// below for catching ctrl+c, and dumping files
struct sigaction sa;
Expand Down

0 comments on commit 834fbfe

Please sign in to comment.