Skip to content

Instantly share code, notes, and snippets.

@mdozmorov
Last active February 2, 2017 02:02
Show Gist options
  • Save mdozmorov/7dfe3c4c097364e2561dd517d92fb2f0 to your computer and use it in GitHub Desktop.
Save mdozmorov/7dfe3c4c097364e2561dd517d92fb2f0 to your computer and use it in GitHub Desktop.
Factor analysis by SVA
# Source: Additional file 1 from Łabaj, Paweł P., and David P. Kreil. “Sensitivity, Specificity, and Reproducibility of RNA-Seq Differential Expression Calls.” Biology Direct 11, no. 1 (December 20, 2016): 66. doi:10.1186/s13062-016-0169-7.
# https://static-content.springer.com/esm/art%3A10.1186%2Fs13062-016-0169-7/MediaObjects/13062_2016_169_MOESM1_ESM.pdf
samples.fc <- c()
for (x in colnames(data.in)) {
sampl <- substr(x, 5, 5)
samples.fc <- c(samples.fc, sampl)
}
group = as.factor(samples.fc)
mod1 = model.matrix(~group)
res <- svaseq(data.in, mod = mod1, constant = 0.5, B = 5, n.sv = 4)
new.dat <- fsva(log(data.in + 0.5), mod1, res, newdat = data.in, method = "exact")
data.out <- exp(new.dat$db) - 0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment