filterOutIterations: Filter Out Iterations

Usage Arguments Examples

Usage

1
filterOutIterations(wall, hall, cnt_errors, cnt_reconstructed, params)

Arguments

wall
hall
cnt_errors
cnt_reconstructed
params

Examples

 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
##---- 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 (wall, hall, cnt_errors, cnt_reconstructed, params) 
{
    num_processesToExtract <- params$num_processesToExtract
    thresh_removeLastPercent <- params$thresh_removeLastPercent
    num_totIterations <- ncol(wall)/num_processesToExtract
    tot.rm.iterations <- round(thresh_removeLastPercent * num_totIterations)
    if (tot.rm.iterations > 0) {
        closeness.mutCounts <- matrix(0, nrow = num_totIterations, 
            ncol = 1)
        for (i in 1:num_totIterations) {
            closeness.mutCounts[i, ] <- base::norm(cnt_errors[[i]], 
                "F")
        }
        indexClosenessGenomes <- order(closeness.mutCounts, decreasing = TRUE)
        removeIterations <- indexClosenessGenomes[1:tot.rm.iterations]
        removeIterationSets <- matrix(0, nrow = (num_processesToExtract * 
            tot.rm.iterations), ncol = 1)
        for (i in 1:tot.rm.iterations) {
            iStart <- num_processesToExtract * (removeIterations[i] - 
                1) + 1
            iEnd <- num_processesToExtract * removeIterations[i]
            tmpRowRange <- (num_processesToExtract * (i - 1) + 
                1):(num_processesToExtract * i)
            removeIterationSets[tmpRowRange, ] <- iStart:iEnd
        }
        wall <- wall[, -removeIterationSets]
        hall <- hall[-removeIterationSets, ]
        cnt_errors <- cnt_errors[-removeIterations]
        cnt_reconstructed <- cnt_reconstructed[-removeIterations]
    }
    res.list <- list()
    res.list$Wall <- wall
    res.list$Hall <- hall
    res.list$mutCounts.errors <- cnt_errors
    res.list$mutCounts.reconstructed <- cnt_reconstructed
    return(res.list)
  }

dami82/mutSignatures_dev documentation built on May 17, 2019, 7:02 p.m.