**80**wrote:

Hi, after searching for how to draw PCA plot using FPKM, there is still a question confusing me.
For example, I have a FPKM matrix (let's say *matrix_sample*) for sample1 sample2 .. sampleN control1, control2 ... controlN (column) and gene1, gene2 ... geneN(row). I want to check if the data have batch effect. So ideally I want to see points representing samples and points representing controls are seperated into 2 parts in the plot.

I note that there are 2 method to draw PCA plots.

a) # note that in this method, rows an columns of matrix_sample are geneN and sampleN(or controlN).

```
pca = prcomp(matrix_sample)
plot(pca$rotation[,1],pca$rotation[,2], xlab = "PC1", ylab = "PC2")
```

b) # note that in this method, matrix_sample is transposed.

```
pca = prcomp(t(matrix_sample))
autoplot(p,label=TRUE)
```

I don't know which method is correct for a) doesn't transpose matrix and b) transpose it. I know that usually row is observation and column is variable. But in biology samples are less than genes so row is gene and column is sample. This can make the matrix more easily to understand. However for me plots are not the same generated by these 2 methods. I don't know why. I didn't find any information or I miss something. Please help me out. Thank you very much!

**39k**• written 5 months ago by hxlei613 •

**80**