Entering edit mode
2.1 years ago
Apex92
▴
320
Dear all,
I have an experimental design where I have only one sample in each condition (2 conditions in total) and want to do differential gene expression analysis using edgeR.
This is the script I want to use for the analysis and it runs without any errors - with this post I just want to check if I am not missing anything specific in the script of edgeR.
Thanks.
##################################
##### edger for 1 vs 1 comparison #####
##################################
library(edgeR)
countData <- read.csv(file="countmatrix.csv", header=TRUE, sep=",")
head(countData)
#select specific samples
countData = subset(countData, select = c(Geneid,ctrl,kd))
head(countData)
#keep tows if their total is above a certain value
thresh <- 50
countData <- countData[rowSums(countData[,-1]) > thresh,]
#############################################
######### Creating a DGEList object #########
########################################
dgList <- DGEList(counts=countData[,-1], genes=countData[,1])
dgList
#################################
######## Normalisation ##########
#################################
dgList <- calcNormFactors(dgList, method="TMM")
########################################
########### Setting up the Model ############
########################################
group <- factor(c("ctrl","kd"))
designMat <- model.matrix(~group)
designMat
designMat.reduced <- matrix(1,2,1)
designMat.reduced
#############################################
########### Estimating Dispersion ###########
#############################################
dgList <- estimateGLMCommonDisp(dgList, design=designMat.reduced,
method="deviance", robust = TRUE, subset=NULL)
####################################
########## Differential Expression ##########
####################################
fit <- glmFit(dgList, designMat)
lrt <- glmLRT(fit)
edgeR_result <- topTags(lrt, n=Inf)
write.table(edgeR_result, file="DEGs.csv", sep=",",row.names = FALSE)
The edgeR manual has a section on doing exploratory analysis without replicates, please read it.
Thank you for your comment - I have already looked at the manual and chose the third option from section 2.12 which is also in the code above. But I just pasted the whole code to see if it is concrete and if I am not missing anything. This is my first time working with edgeR and that is why I am a bit cautious.
As a general rule you should try and understand what each line of code does, by looking in the manual and googling, rather than pasting the whole code in without understanding it. It can be hard at first but it will help you a lot in the long run.
If you follow the manual precisely you're fine.
I just want to verify my code, without replication using edgeR. Please check it and give your suggestions. it may help me to go forward.
Thanks in advance
Are you guys in the same course or is this a duplicate account? Read the manual, code is there.
Sorry, sir. I am not using a duplicate account. I have just seen a similar question here and thought of asking my question here. Because it may help me to get answers to my question very fast. even though some code is given in the manual, I just want to verify my code. with this code, I am not facing any errors. so after doing all the work if the code is wrong in the final, everything will go waste that's why I am asking. Thanks for your time sir Sincerely KAMALAKKANNAN R Phd scholar CUKerala, India
If you are sharing code for others to review, please create a minimal example. That means removing any code which doesn't affect the actual output like the
head(d1)
,d1$samples
, it's all just noise and makes it harder for anyone to follow.Yes, sorry sir I have removed it.. please tell me whether it is ok or not?
Hi Apex92 user, I also have only 2 samples with no replicates, can you share the latest script that you applied for samples with no replicates? I need it. thank you
Guys, learn to read manuals. The edgeR user guide literally has a section "what to do without replicates".
Find it at https://www.bioconductor.org/packages/release/bioc/vignettes/edgeR/inst/doc/edgeRUsersGuide.pdf
thank you for your answer, before, I checked the "2.12 What to do if you have no replicates" section. this script applied estimateGLMCommonDisp method as well but didn't use exactTest(y, dispersion=bcv^2). I just want to know why Apex92 didn't use exactTest. without using exactTest I got logical results but when I applied the exactTest method I got confusing results. what do you think?