R/remove_noise_from_matrix.R
remove_noise_from_matrix.Rd
This function is used to remove the noisy reads from the expression matrix. It uses as input a vector of abundance thresholds; all entries below the noise threshold are replaced with the noise threshold.
remove_noise_from_matrix( expression.matrix, noise.thresholds, add.threshold = TRUE, average.threshold = TRUE, remove.noisy.features = TRUE, export.csv = NULL, ... )
expression.matrix | the expression matrix |
---|---|
noise.thresholds | a vector of expression thresholds by sample; must be the same length as the number of columns of the expression matrix, or a singular value to be used as a fixed noise threshold |
add.threshold | whether to add the noise threshold to all values in the expression matrix (default), or set entries below the threshold to the threshold |
average.threshold | if TRUE (default), uses tthe average of the vector of thresholds across all samples; if FALSE, uses the thresholds as supplied |
remove.noisy.features | logical, whether rows of the expression matrix that are fully under the noise threshold should be removed (default TRUE) |
export.csv | option to write the matrix into a csv after the noise removal; should be NULL or the name of the output file |
... | arguments passed on to other methods |
Returns the expression matrix with the noise removed. Under default parameters, the denoised matrix will have fewer rows than the input matrix and will have no entries remaining below the noise threshold.
expression.matrix <- matrix(1:100, ncol=5) noise.thresholds <- c(5,30,45,62,83) remove_noise_from_matrix( expression.matrix = expression.matrix, noise.thresholds = noise.thresholds )#>#>#>#> [,1] [,2] [,3] [,4] [,5] #> [1,] 47 67 87 107 127 #> [2,] 48 68 88 108 128 #> [3,] 49 69 89 109 129 #> [4,] 50 70 90 110 130 #> [5,] 51 71 91 111 131 #> [6,] 52 72 92 112 132 #> [7,] 53 73 93 113 133 #> [8,] 54 74 94 114 134 #> [9,] 55 75 95 115 135 #> [10,] 56 76 96 116 136 #> [11,] 57 77 97 117 137 #> [12,] 58 78 98 118 138 #> [13,] 59 79 99 119 139 #> [14,] 60 80 100 120 140 #> [15,] 61 81 101 121 141 #> [16,] 62 82 102 122 142 #> [17,] 63 83 103 123 143 #> [18,] 64 84 104 124 144 #> [19,] 65 85 105 125 145