This is a test version of Biostars. For the public version, visit https://www.biostars.org.
PCA plot of RPKM data from RNA-Seq dataset

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

1 answer

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

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.

Log in to answer this question.