Question: PCA plot of RPKM data from RNA-Seq dataset
2
gravatar for ApoorvaB
3.4 years ago by
ApoorvaB190
United States
ApoorvaB190 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.5k views
ADD COMMENTlink modified 3.4 years ago by informatics bot560 • written 3.4 years ago by ApoorvaB190
9
gravatar for informatics bot
3.4 years ago by
United States
informatics bot560 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.4 years ago by informatics bot560

That worked. Thank you very much

ADD REPLYlink written 3.4 years ago by ApoorvaB190
2

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

ADD REPLYlink written 3.4 years ago by informatics bot560

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 6 months ago by Kevin Blighe39k

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 16 months ago by Mehmet460

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 6 months ago by Kevin Blighe39k
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: 1114 users visited in the last hour