use PCA to see the correlation between samples WT and MT
1
1
Entering edit mode
5.8 years ago
Grace_G ▴ 20

Hi,

Is the code right for to use pca show correlation of samples?
gene_tpm_matrix rownames are genes, colnames are samples (WT and MT)

prcomp(log2(gene_tpm_matrix+1), scale=T)

I'm not sure my code(use tpm do log and use scale, I see someone use score), however, so did a test, I use one sample we can call it sample_MT_1 * 10000 to get sample_new, then add sample_new as one line to gene_tpm_matrix, then do PCA, but sample_new point far away from sample_mt_1 point, I think they should overlap completely since they are linearly correlated and PCA which uses linear arithmetic.

What worries me most is the pca code is right or not, is anybody familiar with it?

Thanks!

RNA-Seq R next-gen • 773 views
ADD COMMENT
2
Entering edit mode
5.8 years ago

I'm relatively certain you will have to transpose the matrix first, i.e. columns should represent genes:

prcomp( t (log2(matrix + 1)), scale = TRUE)
ADD COMMENT
0
Entering edit mode

Exactly, I forgot to write this step here, so it is prcomp(t(log2(gene_tpm_matrix+1)), scale=T) now. Thanks!

ADD REPLY

Login before adding your answer.

Traffic: 2397 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6