PCA plot of RPKM data from RNA-Seq dataset
1
2
Entering edit mode
8.5 years ago
AB ▴ 360

Hi everyone,

I have RNA-Seq data from 22 samples and 3 batches. I used bioconductor to generate the RPKM values. I want to see if there is any batch effect in my dataset. How do i use RPKM matrix as an input to perform PCA ? Any help is appreciated.

Thanks,
apoorva

RNA-Seq bioconductor pca rpkm • 9.8k views
ADD COMMENT
9
Entering edit mode
8.5 years ago

I usually make my PCA plots with VST data from DESeq2 in Bioconductor. The following might work for RPKM... but I haven't tried it.

Put your VST matrix (try RPKM matrix) instead of “MATRIX” below (you might have to transpose it using the "t()" function):

pca= prcomp( MATRIX , center=T, scale=T)

pdf("pca.pdf")
plot(pca$rotation[,1],pca$rotation[,2], xlab = "PC1", ylab = "PC2")
text(pca$rotation[,1],pca$rotation[,2], row.names(pca$rotation), cex=0.5, pos=4)
dev.off()
ADD COMMENT
0
Entering edit mode

That worked. Thank you very much

ADD REPLY
2
Entering edit mode

feel free to mark this problem as solved, and up-vote my solution :D

ADD REPLY
0
Entering edit mode

Note that there is a distinction between plotting the component loadings (as done above and held in rotation) and plotting the rotated data multiplied by the component loadings (held in x). Both my own and that of DESeq2 plot the data held in the x variable: A: PCA plot from read count matrix from RNA-Seq

ADD REPLY
0
Entering edit mode

Hi,

I am trying to make a PCA plot. I have 17 samples, how can I make it ?

plot(pca$rotation[,1],pca$rotation[,2], xlab = "PC1", ylab = "PC2")

text(pca$rotation[,1],pca$rotation[,2], row.names(pca$rotation), cex=0.5, pos=4)

When I type the codes above, I receive different results. I mean positions of samples are changing according to the parameter in the code below: plot(pca$rotation[,1],pca$rotation[,2]

plot(pca$rotation[,1],pca$rotation[,17]

these two codes show different positions of samples.

ADD REPLY
0
Entering edit mode

Yes, they will likely differ. You are plotting the 1st and 2nd components in one, whilst, in the other, the 1st and 17th components.

Take a look here: A: PCA plot from read count matrix from RNA-Seq

ADD REPLY

Login before adding your answer.

Traffic: 2439 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