Skip to content

Commit

Permalink
init subclone fraction 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinha committed Jun 4, 2020
1 parent da638a6 commit 3a7a185
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ outputParametersToFile <- function(hmmResults, file){
write.table(paste0("Gaussian variance: ", paste0(signif(x$vars[,s], digits = 2), collapse = ", ")), file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t")
}
write.table(paste0("GC-Map correction MAD:\t", format(mad(diff(2^as.numeric(hmmResults$cna[[s]][,"logR"])), na.rm=T), digits=4)), file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t")
write.table(paste0("Log-likelihood:\t", format(as.numeric(hmmResults.cor$results$loglik[i, "loglik"]), digits=4)), file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t")
write.table("\n", file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t")
}
write.table(x$loglik, file = fc, col.names = TRUE, row.names = FALSE, quote = FALSE, sep = "\t")
Expand Down
2 changes: 1 addition & 1 deletion R/segmentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ getDefaultParameters <- function(x, maxCN = 5, ct.sc = c(1,3), n_0 = 0.5, ploidy
ct.sc.status = c(rep(FALSE, length(ct)), rep(TRUE, length(ct.sc))),
phi_0 = ploidy_0, alphaPhi = 4, betaPhi = 0.75,
n_0 = n_0, alphaN = 1, betaN = 1,
sp_0 = 0.01, alphaSp = 2, betaSp = 2,
sp_0 = 0.5, alphaSp = 2, betaSp = 2,
lambda = as.matrix(rep(100, length(ct)+length(ct.sc)), ncol=1),
nu = 2.1,
kappa = rep(75, length(ct)),
Expand Down
17 changes: 9 additions & 8 deletions scripts/runIchorCNA.R
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,16 @@ save.image(outImage)
### SORT SOLUTIONS BY DECREASING LIKELIHOOD ###
fracAltSub[is.nan(fracAltSub$V1), ] <- 0
if (estimateScPrevalence){ ## sort but excluding solutions with too large % subclonal
if (numSamples > 1){
fracInd <- which(rowSums(fracAltSub <= maxFracCNASubclone) == S &
rowSums(fracGenomeSub <= maxFracGenomeSubclone) == S)
}else{
fracInd <- which(fracAltSub <= maxFracCNASubclone &
fracGenomeSub <= maxFracGenomeSubclone)
}
if (numSamples > 1){
fracInd <- which(rowSums(fracAltSub <= maxFracCNASubclone) == S &
rowSums(fracGenomeSub <= maxFracGenomeSubclone) == S)
}else{
fracInd <- which(fracAltSub <= maxFracCNASubclone &
fracGenomeSub <= maxFracGenomeSubclone)
}
if (length(fracInd) > 0){ ## if there is a solution satisfying % subclonal
ind <- fracInd[order(loglik[fracInd, "loglik"], decreasing=TRUE)]
# sort by highest loglik and then by lowest fracCNAsubclonal (if ties)
ind <- fracInd[order(-loglik[fracInd, "loglik"], loglik[fracInd, "Frac_CNA_subclonal"])]
}else{ # otherwise just take largest likelihood
ind <- order(as.numeric(loglik[, "loglik"]), decreasing=TRUE)
}
Expand Down

0 comments on commit 3a7a185

Please sign in to comment.