Removing Confounding Factor Effects using SVA

cfr_sva(mat, age, cov = NA)

Arguments

mat

a numeric matrix with the expression values, where columns are the samples and rows are probesets, transcripts, or genes.

age

a numeric vector, where the names correspond to samples (the same as colnames of the given matrix).

cov

covariates to analyse SVs.

Value

a list with i) a numeric matrix with the expression values, ii) SVs for each sample, and iii) correlation between SVs and covariates

Examples

sampnames = paste('sample',1:20,sep='') myexp <- sapply( 1:20, function(i){ rnorm(n = 10000, mean = sample(1:3, 1), sd = sample(c(1, 3), 1)) }) colnames(myexp) = sampnames agevec <- sample(20:80,20) names(agevec) = sampnames result_mat <- cfr_sva(myexp,agevec)
#> Number of significant surrogate variables is: 8 #> Iteration (out of 5 ):1 2 3 4 5
print(myexp[1:5,1:5])
#> sample1 sample2 sample3 sample4 sample5 #> [1,] 1.6344855 2.152249 0.9867031 2.792520 -0.005623023 #> [2,] 0.8613537 1.892670 -1.0850652 2.221501 3.618923469 #> [3,] 1.9471171 2.165830 1.4713725 3.014678 3.388419345 #> [4,] 1.6430524 3.431929 1.0257522 2.897891 1.571431039 #> [5,] 1.3218842 2.877333 0.2430339 2.741432 5.385300746
print(result_mat$correctedExp[1:5,1:5])
#> sample1 sample2 sample3 sample4 sample5 #> [1,] -0.3679575 0.10686609 -0.03129762 -0.2271763 -0.014059469 #> [2,] -1.0878495 -0.04840652 -1.62329177 -1.0601329 0.016051265 #> [3,] -0.7078149 -0.46955222 0.27452364 -1.0419228 -0.026707695 #> [4,] -0.2078332 1.54909703 -0.24695464 0.4203431 -0.005673507 #> [5,] -0.9584203 0.61369261 -0.98971666 -0.5536472 -0.006003883
dim(result_mat$correctedExp)
#> [1] 10000 20
head(result_mat$SVs)
#> SV_1 SV_2 SV_3 SV_4 SV_5 #> sample1 0.01852815 -3.339818e-03 0.005042591 0.0100746681 -0.0060938556 #> sample2 0.01638531 -2.279730e-06 0.009879715 0.0012308819 -0.0005983815 #> sample3 -0.18678370 -3.979141e-03 0.010207727 0.0004481191 -0.0061359900 #> sample4 0.22052090 -7.401643e-03 0.006720401 0.0084531081 0.0065031948 #> sample5 0.03912771 -1.516710e-01 -0.076601154 -0.3557168208 0.5687845492 #> sample6 0.04714716 5.161590e-01 0.694451702 -0.2609277419 -0.1656813638 #> SV_6 SV_7 SV_8 #> sample1 -0.005255565 -0.1538935 -0.041312445 #> sample2 -0.002327802 -0.1579122 -0.031283564 #> sample3 -0.008249627 -0.1011968 -0.391975117 #> sample4 0.006643142 -0.2231104 0.313830686 #> sample5 0.615475843 0.3008639 0.006176108 #> sample6 -0.024525553 0.3186825 0.035075428
head(result_mat$SV_cov_corr)
#> NULL