pneuvial / c3co

Inferring cancer cell clonality from copy-number data
5 stars 1 forks source link

Tumor content > 100 #10

Closed pneuvial closed 7 years ago

pneuvial commented 7 years ago

The function getWeightMatrix sometimes returns proportions larger than 100!

I haven't digged in the code to see why this happens, but obviously it should not happen Reproducible example:

> library("c3co")
> set.seed(48)
> M <- getWeightMatrix(100, 0, 3, 15, sparse.coeff=0.7, contam.coeff=0.6, contam.max=2);
> rowSums(M)
 [1]  90 100 100  95 345 100  70 100  85 100  90 100  90  95  95
pneuvial commented 7 years ago

Here's the code I used to find a seed that triggers this problem:

ii <- 1;
while(TRUE) {
  print(ii);
  set.seed(ii); 
  M <- getWeightMatrix(100, 0, 3, 15, sparse.coeff=0.7, contam.coeff=0.6, contam.max=2);
  if (any(rowSums(M)>100)) break;
  ii <- ii+1;
}
pneuvial commented 7 years ago

Fix by @mpierrejean : 52c616788935b1f48b05523f320ebd074078f590

Added a corresponding test script ("test_getWeightMatrix.R") : 0157e12cf9447592e2d268e32b392bfbf2f253d4