Question: PCA plot after batch normalization
0
gravatar for parinv
9 months ago by
parinv10
pune, India
parinv10 wrote:

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 • 285 views
ADD COMMENTlink modified 9 months ago by Kevin Blighe68k • written 9 months ago by parinv10
0
gravatar for Kevin Blighe
9 months ago by
Kevin Blighe68k
Republic of Ireland
Kevin Blighe68k wrote:

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 COMMENTlink written 9 months ago by Kevin Blighe68k

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 REPLYlink modified 9 months ago • written 9 months ago by parinv10

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 REPLYlink written 9 months ago by Kevin Blighe68k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1835 users visited in the last hour