Question: PCA plot of RPKM data from RNA-Seq dataset
2
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
modified 3.8 years ago by informatics bot570 • written 3.8 years ago by ApoorvaB210
9
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()```

That worked. Thank you very much

2

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

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

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.

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