So I have two gene arrays, and I need to select the 15 top-varying genes from each and then plot the methylation data of both against each other. I am running into a problem - how do I actually create the matrix subset with only the 15 top varying genes?
I have been using:
normal <- cancerdata
variances <- matrixStats::rowVars(normal)
select <-order(variances, decreasing = T)[seq_len(min(15, length(variances)))]
normalmatrix <- as.matrix(METnormal[variances, ])
however, this does not create the "normalmatrix" matrix that I want which includes only the selected top-varying gene rows, but also all the sample columns. Does anyone have a solution? Any sample code would be appreciated.
For reference, I am using data sets such as those found here: http://gdac.broadinstitute.org/runs/stddata__2015_04_02/data/ACC/20150402/
0 answers
No answers yet.
Log in to answer this question.
If you just want the top 15 rows of your matrix by variance, you can simply do the following:
That's what your question appears to be asking for, but the code you have seems to be doing other things (i.e. where did METnormal come from?)