This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Up/Down regulated genes list in EdgeR

Hi All,

I am doing differential gene expression analysis on "Edge R". I have to stimulate an article procedure which is

(Differential gene expression was done using edgeR and using a generalized linear model (GLM). DE genes were identified using a log2 fold change, and likelihood ratios (LR) test in edgeR significantly expressed genes had an FDR adjusted P value of < 5%).

So I write the code below in R studio, and now I want to compare my down and upregulated genes with them. I checked a few posts related to my question, but I couldn't get the proper answer to my problem. Is there any way through my codes to get a list of down and upregulated genes that I found?

Thanks in advance

library(edgeR)

group <- factor(c(rep("pro-vaccine",30),rep("pre_vaccine",20)))
x<-read.csv("table_50_ID.csv")
y<-DGEList(counts = x, group=group)
y<-calcNormFactors(y)
design<-model.matrix(object = ~group)
y<-estimateDisp(y,design)
fit<-glmFit(y,design)
lrt<-glmLRT(fit,coef = 2)
topTags(lrt)
FDR <- p.adjust(lrt$table$PValue)
sum(FDR<0.05)
lrt <-glmLRT(fit)
topTags(lrt)
summary(dt<-decideTestsDGE(lrt, p.value = 0.05))

and here is also my results:

Coefficient:  grouppro-vaccine 
      logFC       logCPM        LR        PValue           FDR
57295 -4.101295  1.360712137 1374.4852 7.360032e-301 4.252479e-296
9068  -4.344785  1.067874308 1051.4589 1.172813e-230 3.388140e-226
5677  -4.610764 -0.009603996  958.4642 1.917968e-210 3.693878e-206
33165 -2.939559  1.283327685  953.2145 2.654619e-209 3.834464e-205
4715  -4.641455  0.987098949  744.7318 5.609295e-164 6.481877e-160
24778 -3.296862  0.314347175  703.9992 4.037012e-155 3.887508e-151
38177 -2.903446  0.813450569  681.1693 3.720833e-150 3.071175e-146
25519 -4.101955 -0.452403717  633.1050 1.055625e-139 7.623988e-136
1295  -3.169060  1.382517191  622.5037 2.134096e-137 1.370042e-133
18598 -2.225708  1.284682587  602.2558 5.409457e-133 3.125476e-129

  [,1] 
Down    3312
NotSig 51219
Up      3247
rna-seq edger diffrential gene expression

Hi ali.hakimzadeh,

I think you can try:

deg <- topTags(lrt, n = Inf, p = 0.05)$table
up <- row.names(deg[deg$logFC > 0,])
down <- row.names(deg[deg$logFC < 0,])

Thanks for your reply, SMK But it doesn't give me the output! It shows in R studio in Values part. If I want to mention my CSV file constructed from just counts and sample names that the first row belongs to the sample names and the others are counts of genes belong to them. can it be the problem that I couldn't get a table of up and down?

Can you show us the first few lines of table_50_ID.csv?

Where's your gene ID?

I removed the gene names from the first column since it gets me an error while I try to operate read.csv on my file. I can put them back to the file, but as I told you I get an error!

Is there any way through my codes to get a list of down and upregulated genes that I found?

Then down and up are the row numbers of your down and upregulated genes, no? Or you can just do deg[deg$logFC > 0,] and deg[deg$logFC < 0,].

yeah exactly I just get the numbers, here is what I get in R studio :

down

thank you so much i get what i want and sorry for delay in response ;)

1 answer

In order to generate the list of genes, create DGEList:

y <- DGEList(dat[,-1], genes=dat[,1])

And when you compute y, it should give something like:

> y
An object of class "DGEList"
$counts
  SM_RP_1.accepted_hits.bam SM_RP_2.accepted_hits.bam
1                                     0                                     0
2                                     0                                     0
3                                     0                                     0
4                                    33                                    83
5                                    18                                    58
35815 more rows ...

$samples
                                      group lib.size norm.factors
SM_RP_1.accepted_hits.bam     1  9346812            1
SM_RP_2.accepted_hits.bam     1  9171741            1

$genes
        genes
1 MIR1302-2HG
2     FAM138A
3       OR4F5
4  AL627309.1
5  AL627309.3
35815 more rows ...

To generate the list of genes:

head(y$genes)

Subsequently, you can save it in a text file. The order should be the same.

genelist <- y$genes
write.table(genelist, file="AYA_young_genelist.txt", quote=FALSE, sep="\t")

Log in to answer this question.