<p>Hi everyone,</p>

<p>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.</p>

<p>Thanks,<br />
apoorva</p>

<p>I usually make my PCA plots with VST data from DESeq2 in Bioconductor. The following might work for RPKM... but I haven&#39;t tried it.</p>

<p>Put your VST matrix (try RPKM matrix) instead of &ldquo;MATRIX&rdquo; below (you might have to transpose it using the &quot;t()&quot; function):</p>

<pre>
pca= prcomp( MATRIX , center=T, scale=T)

pdf(&quot;pca.pdf&quot;)
plot(pca$rotation[,1],pca$rotation[,2], xlab = &quot;PC1&quot;, ylab = &quot;PC2&quot;)
text(pca$rotation[,1],pca$rotation[,2], row.names(pca$rotation), cex=0.5, pos=4)
dev.off()</pre>
