Question: PCA plot of RPKM data from RNA-Seq dataset
2
gravatar for ApoorvaB
3.8 years ago by
ApoorvaB210
United States
ApoorvaB210 wrote:

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 pca bioconductor rpkm • 5.9k views
ADD COMMENTlink modified 3.8 years ago by informatics bot570 • written 3.8 years ago by ApoorvaB210
9
gravatar for informatics bot
3.8 years ago by
United States
informatics bot570 wrote:

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 COMMENTlink written 3.8 years ago by informatics bot570

That worked. Thank you very much

ADD REPLYlink written 3.7 years ago by ApoorvaB210
2

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

ADD REPLYlink written 3.7 years ago by informatics bot570

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 REPLYlink written 10 months ago by Kevin Blighe45k

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 REPLYlink written 20 months ago by Mehmet470

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 REPLYlink written 10 months ago by Kevin Blighe45k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1511 users visited in the last hour