PCA plot after batch normalization
1
0
Entering edit mode
4.2 years ago
parinv ▴ 80

I have two microarray datasets with same platform. I performed batch normalization using:

norm1=removeBatchEffect(norm, batch=NULL, batch2=NULL, covariates=NULL, design=matrix(1,ncol(norm),1))

and now I want a PCA plot of test and control samples. I tried using the following codes:

 #pca plot
library(ggfortify)
control<- norm1[,c(1:19,35:63)]
test<-norm1[,c(20:34,64:93)]
autoplot(prcomp(control,test))

# OR
library(ggplot)
df<- data.frame(control=norm1[,c(1:19,35:63)], test=norm1[,c(20:34,64:93)])
ggplot(df, aes(control,test)) + geom_point(aes(shape=control,colour= test))

but the plot is not showing groups of test and control. instead, it plots the genes present in samples.

can anyone point out what's wrong here and suggest any other function in limma or affy?

R • 1.3k views
ADD COMMENT
0
Entering edit mode
4.2 years ago

If the PCA bi-plot is showing genes, then simply transpose your input data [to prcomp] via the t() function.

I have a dedicated package for PCA on Bioconductor, by the way: PCAtools

Kevin

ADD COMMENT
0
Entering edit mode

Thank you for help. Can you suggest how to add colour to PCA plot? I tried the following:

 autoplot(prcomp(t(norm1),scale. = TRUE, colour="control"))

and other one:

autoplot(prcomp(t(norm1),scale. = TRUE, colby="control"))

but it is giving error: Warning message: In prcomp.default(t(norm1), colour = "control") : extra argument ‘colour’ will be disregarded

  • what does this mean? how to correct it?
ADD REPLY
0
Entering edit mode

In both examples of code, you are attempting to pass arguments, colour and colby, to prcomp. prcomp does not accept any arguments by these names

ADD REPLY

Login before adding your answer.

Traffic: 2540 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6