Need help in determing upregulated and downregulated genes
1
0
Entering edit mode
Rishav ▴ 20
@rishav-25031
Last seen 22 months ago
Patna

Hello everyone, Greetings of the day. I am doing differential expression analysis of RNA seq data using DESeq2.

Here are my codes


# #loading our expression data
> hep <- read.csv("hep.csv")

#create experiment labels (two conditions)
> colData <- DataFrame(condition=factor(c("U", "I", "U", "U", "I", "U", "I", "U", "I", "U", "I", "U", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U", "I", "U")))

# create DESeq input matrix
> countDataMatrix <- as.matrix(hep[ , -1])
> rownames(countDataMatrix) <- hep[ , 1]
> dds <- DESeqDataSetFromMatrix(countDataMatrix, colData,formula(~condition))

# run DEseq
> dds <- DESeq(dds)

# visualize differentially expressed genes
> plotMA(dds)

# get differentially expressed genes
> res <- results(dds)

# order by BH adjusted p-value
> resOrdered <- res[order(res$padj),]

# top of ordered matrix
> head(resOrdered)

# how many differentially expressed genes ? FDR=10%, |fold-change|>2 (up and down)
# get differentially expressed gene matrix
> sig <- resOrdered[!is.na(resOrdered$padj) & resOrdered$padj<0.10 & abs(resOrdered$log2FoldChange)>=1,]
> head(sig)
>dim(sig)

#Here is my output table 
#                  baseMean log2FoldChange                 lfcSE                  stat            pvalue     padj
ENSG00000185559 2060.96296009909    -7.90822697617837   1.10122142389957    -7.18132321488469   6.90399166815319E-13    2.10979081387093E-08
ENSG00000167244 3949.71951799667    -5.08717606829602   0.754384957336078   -6.74347495774585   1.54642640462757E-11    2.3628622249507E-07
ENSG00000149948 321.403334257597    -6.05675672917759   0.947898431269116   -6.38966848069193   1.66245778534973E-10    1.69343491541675E-06
ENSG00000225972 1293.57298498576    3.62414564398317    0.592157910519195   6.12023512580551    9.34373799741777E-10    7.13838223657724E-06
ENSG00000002726 56.1685926119863    -3.15318299470966   0.527678364772323   -5.97557755863301   2.29276426158759E-09    1.4012916613971E-05
ENSG00000207805 10.6401492600533    -4.28119895712609   0.792715217804701   -5.40067714226831   6.63898166734393E-08    0.000338134401287
ENSG00000213759 529.226580136276    2.12463768243135    0.406108642472941   5.23169777794845    1.67960198273993E-07    0.000733242242722
ENSG00000225431 32.3231732869748    -2.30244023822726   0.459828852435173   -5.00716783219222   5.52367609453529E-07    0.002109975222161
ENSG00000146755 113.963384966465    -3.4300823355342    0.69271221959034    -4.9516700276526    7.35792915628377E-07    0.002498343967632
ENSG00000081051 2444.2873558266 -3.16862679078253   0.644789347009389   -4.91420462431492   8.91436088073928E-07    0.002724139541545
ENSG00000268916 14.4309338536539    4.36074748766037    0.941713857295316   4.63065022764433    3.64519195369733E-06    0.010126674628458
ENSG00000226674 58.3897020661263    2.28950978708294    0.49820234156553    4.59554200385427    4.31625829754784E-06    0.010991711442897
ENSG00000240280 43.9359006543918    4.00711572786826    0.881318877406284   4.54672631052812    5.44867771430736E-06    0.012361076873163
ENSG00000260468 6.7333035049915 1.78191180184629    0.39261294093126    4.53859670957274    5.66298230388024E-06    0.012361076873163
ENSG00000144407 141.648572691354    3.10707268649824    0.697153223423106   4.45680028737749    8.31920389624939E-06    0.016948436791032
ENSG00000224271 5.62601524439391    4.14894392002511    0.938786651098153   4.41947477115472    9.89410705328228E-06    0.017785530437721
ENSG00000266976 69.4694521188834    3.62763362034337    0.819229796198089   4.42810263637702    9.50656643611501E-06    0.017785530437721
ENSG00000124333 75.3122612551427    1.86859729730161    0.42444319890528    4.40246728448254    1.07026732667891E-05    0.018170166242212
ENSG00000108849 11.5714376765048    -6.53424383502879   1.50322134616343    -4.34682746603201   1.38120780494038E-05    0.022214910163775
ENSG00000137434 18.1272824429854    -1.56573178834447   0.363351519148957   -4.30913786190224   1.63892185405838E-05    0.024548070212095
ENSG00000214814 79.102503812347 -3.53012101909442   0.820434185566485   -4.30274735158309   1.68693175317906E-05    0.024548070212095
ENSG00000116017 799.692245375309    -1.74222460326634   0.406662384483919   -4.28420397297708   1.83394607706386E-05    0.02547434462227
ENSG00000176566 13.2968817707014    4.95489705054512    1.16245918134296    4.26242669856233    2.02218841381916E-05    0.026867850320826
ENSG00000184368 162.58416359746 -2.81013518467859   0.667606961944708   -4.20926584781681   2.56201797362355E-05    0.032621961356651
ENSG00000112164 20.8835046336506    -3.38561722888854   0.817704276653758   -4.14039320271541   3.46711000502653E-05    0.041270008145417
ENSG00000171004 27.4773686946661    -2.64659962606986   0.64275932734876    -4.11755926901363   3.82906073410181E-05    0.041270008145417
ENSG00000187922 7.34933234064925    2.04931419571231    0.498331216458142   4.11235364759543    3.91645746332371E-05    0.041270008145417
ENSG00000272620 27.9589191748043    2.52755230744927    0.612831220135527   4.12438567814855    3.71725566875677E-05    0.041270008145417
ENSG00000144045 84.7602950281065    -2.88426440799247   0.715357797805104   -4.03191859631937   5.53233512132309E-05    0.056354209657504
ENSG00000236254 1.78090497100626    3.37973217752836    0.850391083903516   3.97432692028533    7.05785644901908E-05    0.069574527492121
ENSG00000251775 12.8515566707548    1.18084328772373    0.298992607613174   3.94940629853786    7.83452718012966E-05    0.074817286280495
ENSG00000251199 4.25714234412063    4.35370844102631    1.11319774138175    3.91099288040443    9.19174820054295E-05    0.08511837371527
ENSG00000073792 1032.69179338924    -2.00886422868782   0.515737834607477   -3.89512673666214   9.81473976860241E-05    0.088214303702565
ENSG00000275325 5.92655429825542    -2.9449307887884    0.758921164537715   -3.88041726386991   0.000104277413332   0.091046099257144
ENSG00000158639 34.5094755666945    3.13929027696926    0.8155897399841 3.84910466999065    0.000118550345532   0.099822574573307
ENSG00000233797 7.30499491728945    -2.17425214494496   0.566532412943642   -3.83782480096377   0.000124128990929   0.099822574573307
ENSG00000268460 8.57078380261895    2.48504144410798    0.647351546931695   3.83878196613036    0.000123646166067   0.099822574573307

Now, I want to determine in this table, which genes upregulated genes and which genes are downregulated. Any help would be appreciated.

RNASeqR • 2.0k views
ADD COMMENT
1
Entering edit mode
Kevin Blighe ★ 4.0k
@kevin
Last seen 4 weeks ago
Republic of Ireland

Hi,

We would usually qualify 'up- / down-regulated' in the context of statistical significance. If you literally just want anything that has a positive or negative log2 fold-change, then one can just do:

subset(sig, log2FoldChange > 0) # up-regulated
subset(sig, log2FoldChange < 0) # down-regulated

However, we can add an extra filter for statistical significance (adjusted p-value < 0.05):

subset(sig, log2FoldChange > 0 & padj < 0.05) # statistically significantly up-regulated
subset(sig, log2FoldChange < 0 & padj < 0.05) # statistically significantly down-regulated

Or, perhaps we want statistically significantly differentially expressed genes that have positive or negative log2 fold-change greater or less than 1:

subset(sig, abs(log2FoldChange) > 1 & padj < 0.05)

Notice the use of abs() function, to compute an absolute value or values.

Kevin

ADD COMMENT
1
Entering edit mode

Thanks for the clarification. I was just little bit confused. Thanks for providing your time..

ADD REPLY

Login before adding your answer.

Traffic: 791 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