computes mean expression
rcpp_meanMatrix_parallel(expression, ps, psgroup, ncores = 1L)
sparseMatrix
## load example PhyloExpressionSetExample
data("PhyloExpressionSetExample", package="myTAI")
## convert into sparseMatrix - rownames GeneID
spmat <- as(data.matrix(PhyloExpressionSetExample[,-c(1,2)]),
"sparseMatrix")
rownames(spmat) <- PhyloExpressionSetExample$GeneID
## create named Phylostratum vector
ps <- setNames(PhyloExpressionSetExample$Phylostratum,
PhyloExpressionSetExample$GeneID)
psgroup <- sort(unique(ps))
## get meanMatrix
rcpp_meanMatrix_parallel(spmat, ps, psgroup)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 2607.882 2579.372 2604.856 2525.704 2554.825 2622.757 2696.331
#> [2,] 2597.258 2574.745 2467.679 2388.045 2296.410 2243.716 2321.709
#> [3,] 2528.272 2363.159 2019.436 2099.079 2155.642 2196.875 2855.866
#> [4,] 1925.320 1887.078 1771.399 1787.175 1740.823 1867.981 2358.893
#> [5,] 2378.883 2368.593 2061.729 2077.087 2076.693 2564.904 3157.761
#> [6,] 1658.253 1697.242 1485.401 1462.613 1492.861 1631.741 2304.683
#> [7,] 1993.321 1717.659 1480.525 1590.009 1545.078 1600.264 2385.409
#> [8,] 1781.653 1670.106 1452.180 1414.052 1359.376 1816.718 2364.070
#> [9,] 1758.119 1764.748 1708.815 1575.727 1388.920 1687.314 2193.930
#> [10,] 2414.456 2501.390 2163.810 1938.060 1770.039 1993.032 2127.015
#> [11,] 1999.163 2071.456 1702.779 1710.290 1662.099 1726.865 2501.443
#> [12,] 2126.189 2036.804 1896.964 1909.578 1859.485 1995.732 2387.343