1 | decipherMutationalProcesses(input, params)
|
input |
|
params |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (input, params)
{
if (class(params) == "mutFrameworkParams" & class(input) ==
"mutationCounts") {
paramsList <- as.list(params)
inputMAT <- as.matrix(input)
}
else {
stop("Malformed Input")
}
if (paramsList$approach != "counts") {
freq.input <- frequencize(inputMAT)
inputMAT <- freq.input$freqs
inputColsums <- freq.input$colSums
}
currentWarnings <- options()$warn
options(warn = -1)
if (is.numeric(paramsList$num_processesToExtract)) {
paramsList$analyticApproach <- "denovo"
}
else {
stop("An error occurred!")
}
if (paramsList$analyticApproach == "denovo") {
deconvData <- deconvoluteMutCounts(input_mutCounts = inputMAT,
params = paramsList)
}
else {
stop("An error occurred!")
}
mutProcesses <- list()
final.proc <- data.frame(deconvData$processes, stringsAsFactors = FALSE)
colnames(final.proc) <- paste("Sign.", sapply(1:ncol(final.proc),
(function(n) {
leadZeros(n, (10 * ncol(final.proc)))
})), sep = "")
rownames(final.proc) <- getMutationTypes(input)
signResult <- as.mutation.signatures(final.proc)
final.expo <- data.frame(deconvData$exposure, stringsAsFactors = FALSE)
if (getFwkParam(params, "approach") != "counts") {
final.expo <- data.frame(sapply(1:ncol(final.expo), function(cjj) {
inputColsums[cjj] * final.expo[, cjj]/sum(final.expo[,
cjj])
}), row.names = NULL, stringsAsFactors = FALSE)
}
tryCatch({
colnames(final.expo) <- getSampleIdentifiers(input)
}, error = function(e) {
NULL
})
rownames(final.expo) <- colnames(final.proc)
expoResult <- as.mutation.exposure(x = final.expo)
mutProcesses$Results <- list()
mutProcesses$Results$signatures <- signResult
mutProcesses$Results$exposures <- expoResult
mutProcesses$RunSpecs <- list()
mutProcesses$RunSpecs$input <- input
mutProcesses$RunSpecs$params <- params
if (getFwkParam(params, "logIterations") != "lite") {
mutProcesses$Supplementary <- list()
mutProcesses$Supplementary$allProcesses <- deconvData$Wall
mutProcesses$Supplementary$allExposures <- deconvData$Hall
mutProcesses$Supplementary$idx <- deconvData$idx
mutProcesses$Supplementary$mutCountErrors <- deconvData$mutCountErrors
mutProcesses$Supplementary$mutCountReconstructed <- deconvData$mutCountReconstructed
mutProcesses$Supplementary$processStab <- deconvData$processStab
mutProcesses$Supplementary$processStabAvg <- deconvData$processStabAvg
}
options(warn = currentWarnings)
return(mutProcesses)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.