Filter rows of p-value matrix under the significance threshold

filterPmat(x, threshold)

Arguments

x

A matrix of p-values. It must be raw p-values and should not be transformed (e.g. logarithmic).

threshold

A numeric value, the minimal p-value used to filter rows. If missing, given the values of NA, NULL or number 0, no filtering will be done and the input matrix will be returned.

Value

Matrix of p-values. If no line is left, a empty matrix of the same dimension as input will be returned.

Author

Jitao David Zhang <jitao_david.zhang@roche.com>

Examples

set.seed(1235)
testMatrix <- matrix(runif(100,0,1), nrow=10)

## filtering
(testMatrix.filter <- filterPmat(testMatrix, threshold=0.05))
#>            [,1]        [,2]      [,3]      [,4]       [,5]       [,6]
#> [1,] 0.09942167 0.519080359 0.8610312 0.7301602 0.02303889 0.29758641
#> [2,] 0.42356115 0.006524904 0.7941721 0.5956656 0.89373905 0.67286840
#> [3,] 0.54449943 0.913918048 0.3366246 0.2526326 0.31682109 0.11527104
#> [4,] 0.21233559 0.846787080 0.4409803 0.1011335 0.11404830 0.06292524
#>            [,7]        [,8]      [,9]     [,10]
#> [1,] 0.08470704 0.667210379 0.1024085 0.1629068
#> [2,] 0.47513906 0.866471735 0.8204760 0.2696054
#> [3,] 0.30904022 0.006296073 0.4914639 0.7755592
#> [4,] 0.10296535 0.042746874 0.3686046 0.6102488
## more strict filtering
(testMatrix.strictfilter <- filterPmat(testMatrix, threshold=0.01))
#>           [,1]        [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,] 0.4235611 0.006524904 0.7941721 0.5956656 0.8937391 0.6728684 0.4751391
#> [2,] 0.5444994 0.913918048 0.3366246 0.2526326 0.3168211 0.1152710 0.3090402
#>             [,8]      [,9]     [,10]
#> [1,] 0.866471735 0.8204760 0.2696054
#> [2,] 0.006296073 0.4914639 0.7755592
## no filtering
(testMatrix.nofilter <- filterPmat(testMatrix))
#>             [,1]        [,2]      [,3]      [,4]       [,5]       [,6]
#>  [1,] 0.24259237 0.955264658 0.1735149 0.6600869 0.49964633 0.36426726
#>  [2,] 0.51535594 0.542894020 0.9506383 0.4464108 0.91183977 0.35510430
#>  [3,] 0.09942167 0.519080359 0.8610312 0.7301602 0.02303889 0.29758641
#>  [4,] 0.90153593 0.629080697 0.2500496 0.5944550 0.47802527 0.28223439
#>  [5,] 0.83890292 0.743721835 0.2265801 0.3249363 0.88662049 0.49429587
#>  [6,] 0.42356115 0.006524904 0.7941721 0.5956656 0.89373905 0.67286840
#>  [7,] 0.54449943 0.913918048 0.3366246 0.2526326 0.31682109 0.11527104
#>  [8,] 0.74531624 0.601582744 0.5318425 0.3366423 0.49811558 0.91560261
#>  [9,] 0.54546342 0.656368798 0.2052040 0.6242061 0.71044726 0.59158016
#> [10,] 0.21233559 0.846787080 0.4409803 0.1011335 0.11404830 0.06292524
#>             [,7]        [,8]      [,9]      [,10]
#>  [1,] 0.09635398 0.845977069 0.5661316 0.54604221
#>  [2,] 0.49347185 0.538405826 0.6771958 0.05492638
#>  [3,] 0.08470704 0.667210379 0.1024085 0.16290676
#>  [4,] 0.64331855 0.120438496 0.3671928 0.36080728
#>  [5,] 0.98718476 0.540113622 0.5900340 0.64481398
#>  [6,] 0.47513906 0.866471735 0.8204760 0.26960538
#>  [7,] 0.30904022 0.006296073 0.4914639 0.77555919
#>  [8,] 0.88986665 0.391184572 0.8414607 0.67942271
#>  [9,] 0.95679199 0.977328825 0.3580521 0.99959032
#> [10,] 0.10296535 0.042746874 0.3686046 0.61024876