-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·446 lines (383 loc) · 23.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="author" content="Shubham Dutta" />
<meta name="date" content="2021-11-24" />
<title>Real time qPCR data analysis using R</title>
<script src="site_libs/header-attrs-2.11/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<style>h1 {font-size: 34px;}
h1.title {font-size: 38px;}
h2 {font-size: 30px;}
h3 {font-size: 24px;}
h4 {font-size: 18px;}
h5 {font-size: 16px;}
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">code{white-space: pre;}</style>
<script type="text/javascript">
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() { hljs.initHighlighting(); }, 0);
}
}
</script>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
pre code {
padding: 0;
}
</style>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
</head>
<body>
<div class="container-fluid main-container">
<div id="header">
<h1 class="title toc-ignore">Real time qPCR data analysis using R</h1>
<h4 class="author">Shubham Dutta</h4>
<h4 class="date">11/24/2021</h4>
</div>
<p><br></p>
<div id="introduction" class="section level3">
<h3>Introduction</h3>
<p>I will be using the <a href="https://www.tidyverse.org/">Tidyverse</a> package in R to analyse and plot a simple RT-qPCR experiment data. In this experiment, I have ectopically-expressed two proteins namely NKG2A and NKG2C (along with their binding partner CD94) in HEK293 cells. I want to assess the expression status of these genes in the HEK293 cells relative to GAPDH using the <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> method. The experiment was run in a <a href="https://www.bio-rad.com/en-us/product/c1000-touch-thermal-cycler?ID=LGTW9415">C1000 Touch Thermal Cycler</a> instrument. The csv file can be found <a href="https://github.com/shubhamdutta26/qPCR-data-analysis-R/blob/main/qPCR_HEKs_OE_NKG2A-C_human.csv">here</a>.</p>
<p><br></p>
</div>
<div id="the-deltadeltact-method-for-gene-expression-analysis" class="section level3">
<h3>The <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> method for gene expression analysis</h3>
<p>The <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> method (also known as the 2<sup>–∆∆C<sub>T</sub></sup> method) is a simple formula used to calculate the relative fold gene expression of samples when performing RT-qPCR. The method was developed by Kenneth Livak and Thomas Schmittgen in 2001 and is widely used (<a href="https://doi.org/10.1006/meth.2001.1262">Livak & Schmittgen, 2001</a>).</p>
<p>C<sub>T</sub> (or C<sub>Q</sub>) stands for the Cycle Threshold (or Cycle Quantification) of a sample. This is given after the qPCR reaction by the software. Simply put, it is the cycle number where the fluorescence generated by the PCR product is distinguishable from the background fluorescence signal.</p>
<p><em>The symbol <span class="math inline">\(\Delta\)</span> (Delta) is a mathematical term used to describe the difference between two values.</em></p>
<p>Let’s see how we can calculate the <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub>:</p>
<blockquote>
<p><span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> = <span class="math inline">\(\Delta\)</span>C<sub>T</sub> (treated sample) – <span class="math inline">\(\Delta\)</span>C<sub>T</sub> (untreated sample)</p>
</blockquote>
<p>Essentially, <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> is the difference between the <span class="math inline">\(\Delta\)</span>C<sub>T</sub> values of the treated/experimental sample and the untreated/control sample. But what does <span class="math inline">\(\Delta\)</span>C<sub>T</sub> refer to?</p>
<blockquote>
<p><span class="math inline">\(\Delta\)</span>C<sub>T</sub> = C<sub>T</sub> (gene of interest) – C<sub>T</sub> (housekeeping gene)</p>
</blockquote>
<p>Basically, <span class="math inline">\(\Delta\)</span>C<sub>T</sub> is the difference in <span class="math inline">\(\Delta\)</span>C<sub>T</sub> values for your gene of interest and your housekeeping gene for a given sample. This is to essentially normalise the gene of interest to a gene which is not affected by your experiment.</p>
<p>Finally, to work out the fold gene expression (F<sub>C</sub>) we need to do 2 to the power of negative <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub>:</p>
<blockquote>
<p>F<sub>C</sub> = 2<sup>(–<span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub>)</sup></p>
</blockquote>
<p>Let us move to the fun part now! <br><br></p>
</div>
<div id="data-analysis" class="section level3">
<h3>Data Analysis</h3>
<div id="install-and-load-tidyverse-package" class="section level4">
<h4>Install and load Tidyverse package</h4>
<p>We will use the <a href="https://www.tidyverse.org/">Tidyverse</a> package for the data analysis.</p>
<p>Install the Tidyverse package:<br><br> <code>install.packages("tidyverse")</code> <br><br> Load the Tidyverse package into R Studio environment:</p>
<pre class="r"><code>library(tidyverse)</code></pre>
<p><br></p>
</div>
<div id="importing-the-data" class="section level4">
<h4>Importing the data</h4>
<p>Now we will import the qPCR data (a csv document in this case) into the R Studio environment using the <code>read.csv</code> function and store it as a dataframe (df) called <strong>qpcr</strong>.<br></p>
<pre class="r"><code>qpcr <- read.csv("qPCR_HEKs_OE_NKG2A-C_human.csv", stringsAsFactors = FALSE)
tibble(qpcr)</code></pre>
<pre><code>## # A tibble: 60 × 15
## Well Fluor Target Content Sample Biological.Set.… Cq Cq.Mean Cq.Std..Dev
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <int>
## 1 A01 SYBR GAPDH Unkn Sample… empty vector 14.5 14.5 0
## 2 A02 SYBR NKG2A Unkn Sample… empty vector 20.0 20.0 0
## 3 A03 SYBR NKG2C Unkn Sample… empty vector 17.5 17.5 0
## 4 A04 SYBR CD94 Unkn Sample… empty vector 19.8 19.8 0
## 5 A05 SYBR GAPDH Unkn Sample… pcDNA-NKG2A 14.5 14.5 0
## 6 A06 SYBR NKG2A Unkn Sample… pcDNA-NKG2A 14.3 14.3 0
## 7 A07 SYBR NKG2C Unkn Sample… pcDNA-NKG2A 19.2 19.2 0
## 8 A08 SYBR CD94 Unkn Sample… pcDNA-NKG2A 14.4 14.4 0
## 9 A09 SYBR GAPDH Unkn Sample… pcDNA-NKG2C 14.5 14.5 0
## 10 A10 SYBR NKG2A Unkn Sample… pcDNA-NKG2C 22.3 22.3 0
## # … with 50 more rows, and 6 more variables: Starting.Quantity..SQ. <dbl>,
## # Log.Starting.Quantity <dbl>, SQ.Mean <dbl>, SQ.Std..Dev <int>,
## # Set.Point <int>, Well.Note <lgl></code></pre>
<p>There are 15 columns (variables) in our data but we only need a some them for our data analysis. Therefore, using the <code>select</code> function we will extract the columns we need and store them in a new df called <strong>tidyData</strong>.</p>
<pre class="r"><code>tidyData <- qpcr %>% select(Target:Cq, -Content)
glimpse(tidyData)</code></pre>
<pre><code>## Rows: 60
## Columns: 4
## $ Target <chr> "GAPDH", "NKG2A", "NKG2C", "CD94", "GAPDH", "NKG2A…
## $ Sample <chr> "Sample 1", "Sample 1", "Sample 1", "Sample 1", "S…
## $ Biological.Set.Name <chr> "empty vector", "empty vector", "empty vector", "e…
## $ Cq <dbl> 14.45711, 20.02642, 17.51733, 19.79295, 14.48283, …</code></pre>
<p>Lets look at the 4 columns now:</p>
<ul>
<li><strong>Target</strong>: This variable stores the different target genes which in this case are GAPDH, NKG2A, NKG2B, and CD94.</li>
<li><strong>Sample</strong>: These are different biological replicates. There are 5 replicates. There are no technical replicates for this experiment.</li>
<li><strong>Biological.Set.Name</strong>: This variable stores the three different conditions. HEK cells are transfected with empty vector (empty vector), NKG2A/ CD94 (pcDNA-NKG2A), and NKG2C/ CD94 (pcDNA-NKG2C).</li>
<li><strong>C<sub>q</sub></strong>: The C<sub>q</sub> (or C<sub>T</sub>) value for each condition. From here on till the end I will be using C<sub>T</sub> and C<sub>Q</sub> interchangeably.</li>
</ul>
<p><br></p>
</div>
<div id="calculate-deltact" class="section level4">
<h4>Calculate <span class="math inline">\(\Delta\)</span>C<sub>T</sub></h4>
<p>The <span class="math inline">\(\Delta\)</span>C<sub>T</sub> is the differnce between the C<sub>T</sub> of the housekeeping gene and the target gene. To calculate <span class="math inline">\(\Delta\)</span>C<sub>T</sub> we need to determine the average C<sub>T</sub> of GAPDH for three conditions (empty vector, pcDNA-NKG2A, and pcDNA-NKG2C).</p>
<p>We will use the <code>filter</code> function to extract and store the C<sub>T</sub> values of GAPDH in a new df called <strong>gapdh_only</strong>. Then we will use the <code>group_by</code>, <code>summarise</code>, and <code>mean()</code> functions to calculate mean C<sub>T</sub>s for the three conditions and store the values in another df called <strong>avg_gapdh</strong>.</p>
<p><code>%>%</code> is called the pipe operator. This special operational function available under the <a href="https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html">magrittr</a> and <a href="https://dplyr.tidyverse.org/">dplyr</a> package (basically developed under magrittr), which allows us to pass the result of one function/argument to the other one in sequence.</p>
<pre class="r"><code>gapdh_only <- tidyData %>% filter(Target == "GAPDH")
avg_gapdh <- gapdh_only %>% group_by(Biological.Set.Name) %>% summarize(ref_cq = mean(Cq))
avg_gapdh</code></pre>
<pre><code>## # A tibble: 3 × 2
## Biological.Set.Name ref_cq
## <chr> <dbl>
## 1 empty vector 14.5
## 2 pcDNA-NKG2A 14.5
## 3 pcDNA-NKG2C 14.5</code></pre>
<p>We have stored the mean GAPDH C<sub>T</sub> value as <em>ref_cq</em>.<br> We will subtract the <em>ref_cq</em> from the <em>Cq</em> of the other target genes. Let’s take <em>NKG2A</em> as an example and see a step-by-step process:</p>
<p>First, we will extract the NKG2A target gene data for all the conditions and store it in <em>nkg2a_only</em> df.</p>
<pre class="r"><code>nkg2a_only <- tidyData %>% filter(Target == "NKG2A")
head(nkg2a_only)</code></pre>
<pre><code>## Target Sample Biological.Set.Name Cq
## 1 NKG2A Sample 1 empty vector 20.02642
## 2 NKG2A Sample 1 pcDNA-NKG2A 14.33777
## 3 NKG2A Sample 1 pcDNA-NKG2C 22.30218
## 4 NKG2A Sample 2 empty vector 20.04060
## 5 NKG2A Sample 2 pcDNA-NKG2A 14.40104
## 6 NKG2A Sample 2 pcDNA-NKG2C 22.33502</code></pre>
<p>Second, we will join the <em>avg_gapdh</em> & <em>nkg2a_only</em> dfs using <code>left_join</code>:</p>
<pre class="r"><code>nkg2a_gapdh <- left_join(nkg2a_only, avg_gapdh, by = "Biological.Set.Name")
head(nkg2a_gapdh)</code></pre>
<pre><code>## Target Sample Biological.Set.Name Cq ref_cq
## 1 NKG2A Sample 1 empty vector 20.02642 14.45323
## 2 NKG2A Sample 1 pcDNA-NKG2A 14.33777 14.47301
## 3 NKG2A Sample 1 pcDNA-NKG2C 22.30218 14.45229
## 4 NKG2A Sample 2 empty vector 20.04060 14.45323
## 5 NKG2A Sample 2 pcDNA-NKG2A 14.40104 14.47301
## 6 NKG2A Sample 2 pcDNA-NKG2C 22.33502 14.45229</code></pre>
<p>Finally, we will calculate the <span class="math inline">\(\Delta\)</span>C<sub>T</sub> for the NKG2A dataset and store the values in <em>nkg2a_gapdh</em> df. The <code>mutate</code> function basically calculates <em>del_cq</em> values and adds a new column (variable) to the existing df.</p>
<pre class="r"><code>nkg2a_gapdh <- nkg2a_gapdh %>% mutate(del_cq = ref_cq - Cq)
head(nkg2a_gapdh)</code></pre>
<pre><code>## Target Sample Biological.Set.Name Cq ref_cq del_cq
## 1 NKG2A Sample 1 empty vector 20.02642 14.45323 -5.57319533
## 2 NKG2A Sample 1 pcDNA-NKG2A 14.33777 14.47301 0.13524120
## 3 NKG2A Sample 1 pcDNA-NKG2C 22.30218 14.45229 -7.84988870
## 4 NKG2A Sample 2 empty vector 20.04060 14.45323 -5.58737658
## 5 NKG2A Sample 2 pcDNA-NKG2A 14.40104 14.47301 0.07196972
## 6 NKG2A Sample 2 pcDNA-NKG2C 22.33502 14.45229 -7.88272978</code></pre>
<p>Please feel free to use the dataset to calculate the <span class="math inline">\(\Delta\)</span>C<sub>T</sub> for NKG2C and CD94 genes.</p>
<p><br></p>
</div>
<div id="calculate-deltadeltact" class="section level4">
<h4>Calculate <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub></h4>
<p>The <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> is the difference between the <span class="math inline">\(\Delta\)</span>C<sub>T</sub> values of treated/experimental sample and the untreated/control sample.</p>
<p>First, we calculate mean C<sub>T</sub> for “empty vector” from <em>nkg2a_gapdh</em> df and store it in the <strong>nkg2a_empty</strong> variable.</p>
<pre class="r"><code>nkg2a_empty <- nkg2a_gapdh %>% filter(Biological.Set.Name == "empty vector") %>% summarise(mean_empty = mean(del_cq)) %>% pull(mean_empty)
nkg2a_empty</code></pre>
<pre><code>## [1] -5.592248</code></pre>
<p>Second, we calculate the <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> values and append the values to <em>nkg2a_gapdh</em> df.</p>
<pre class="r"><code>nkg2a_gapdh <- nkg2a_gapdh %>% mutate(del_del_cq = del_cq - nkg2a_empty)
head(nkg2a_gapdh)</code></pre>
<pre><code>## Target Sample Biological.Set.Name Cq ref_cq del_cq del_del_cq
## 1 NKG2A Sample 1 empty vector 20.02642 14.45323 -5.57319533 0.01905276
## 2 NKG2A Sample 1 pcDNA-NKG2A 14.33777 14.47301 0.13524120 5.72748929
## 3 NKG2A Sample 1 pcDNA-NKG2C 22.30218 14.45229 -7.84988870 -2.25764061
## 4 NKG2A Sample 2 empty vector 20.04060 14.45323 -5.58737658 0.00487151
## 5 NKG2A Sample 2 pcDNA-NKG2A 14.40104 14.47301 0.07196972 5.66421781
## 6 NKG2A Sample 2 pcDNA-NKG2C 22.33502 14.45229 -7.88272978 -2.29048169</code></pre>
<p>Next, we can calculate the fold change gene expression for each condition using the F<sub>C</sub> formula above.</p>
<pre class="r"><code>nkg2a_geneExp <- nkg2a_gapdh %>% mutate(geneExp = 2^(del_del_cq))
head(nkg2a_geneExp)</code></pre>
<pre><code>## Target Sample Biological.Set.Name Cq ref_cq del_cq del_del_cq
## 1 NKG2A Sample 1 empty vector 20.02642 14.45323 -5.57319533 0.01905276
## 2 NKG2A Sample 1 pcDNA-NKG2A 14.33777 14.47301 0.13524120 5.72748929
## 3 NKG2A Sample 1 pcDNA-NKG2C 22.30218 14.45229 -7.84988870 -2.25764061
## 4 NKG2A Sample 2 empty vector 20.04060 14.45323 -5.58737658 0.00487151
## 5 NKG2A Sample 2 pcDNA-NKG2A 14.40104 14.47301 0.07196972 5.66421781
## 6 NKG2A Sample 2 pcDNA-NKG2C 22.33502 14.45229 -7.88272978 -2.29048169
## geneExp
## 1 1.0132940
## 2 52.9841626
## 3 0.2091137
## 4 1.0033824
## 5 50.7106832
## 6 0.2044073</code></pre>
<p>Finally, let us calculate statistical parameters using <code>mean()</code> and <code>sd()</code> for the data:</p>
<pre class="r"><code>nkg2a_geneExp_final <- nkg2a_geneExp %>% group_by(Biological.Set.Name) %>% summarise(mean_geneExp = mean(geneExp), sd_geneExp = sd(geneExp)) %>% mutate(Target = c("NKG2A", "NKG2A", "NKG2A"))
head(nkg2a_geneExp_final)</code></pre>
<pre><code>## # A tibble: 3 × 4
## Biological.Set.Name mean_geneExp sd_geneExp Target
## <chr> <dbl> <dbl> <chr>
## 1 empty vector 1.00 0.0211 NKG2A
## 2 pcDNA-NKG2A 51.0 1.13 NKG2A
## 3 pcDNA-NKG2C 0.211 0.00576 NKG2A</code></pre>
<p>Please feel free to use the dataset to calculate the <span class="math inline">\(\Delta\)</span><span class="math inline">\(\Delta\)</span>C<sub>T</sub> for NKG2C and CD94 genes.</p>
<p>Lets move on to the visualization of our data.</p>
</div>
</div>
<div id="data-visualization" class="section level3">
<h3>Data Visualization</h3>
<p>Before plotting the data let us make a single df. We will use <code>full_join</code> to accomplish this and make a new df called <strong>all</strong> which contains the analysis for individual targets namely NKG2C (<strong>nkg2c_geneExp_final</strong>) and CD94 (<strong>cd94_geneExp_final</strong>).</p>
<pre class="r"><code>all <- full_join(nkg2a_geneExp_final, nkg2c_geneExp_final)
all <- full_join(all, cd94_geneExp_final)</code></pre>
<pre class="r"><code>all</code></pre>
<pre><code>## # A tibble: 9 × 4
## Biological.Set.Name mean_geneExp sd_geneExp Target
## <chr> <dbl> <dbl> <chr>
## 1 empty vector 1.00 0.0211 NKG2A
## 2 pcDNA-NKG2A 51.0 1.13 NKG2A
## 3 pcDNA-NKG2C 0.211 0.00576 NKG2A
## 4 empty vector 1.00 0.0727 NKG2C
## 5 pcDNA-NKG2A 0.266 0.0564 NKG2C
## 6 pcDNA-NKG2C 8.55 0.0526 NKG2C
## 7 empty vector 1.02 0.241 CD94
## 8 pcDNA-NKG2A 35.2 0.179 CD94
## 9 pcDNA-NKG2C 34.8 0.109 CD94</code></pre>
<p>Let us now use <code>ggplot</code> package to plot a bar plot for the RT-qPCR data.</p>
<pre class="r"><code>final_plot <- ggplot(all, aes(x = Biological.Set.Name, y = mean_geneExp, fill = Target)) +
geom_bar(stat = "identity", width = 0.5, position = position_dodge(0.6), color = "#434343") +
geom_errorbar(aes(ymin = mean_geneExp - sd_geneExp, ymax = mean_geneExp + sd_geneExp), width=.2, position = position_dodge(0.6)) +
theme_bw()+
labs(title = "Human NKG2A/C-CD94 overexpression status in HEK293 cells",
subtitle = "2021.11.23 Shubham Dutta",
x = "Transfection (Human genes)",
y = "Expression relative to GAPDH",
fill = "Target gene",
caption = NULL)+
theme(plot.title=element_text(size=13),
axis.text=element_text(size=12, color = "#434343"),
axis.title=element_text(size=13),
legend.text=element_text(size=10),
legend.title=element_text(size=12),
legend.position = c(0.2, 0.8),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank())+
scale_fill_manual(values = c("#d55e00", "#0072b2", "#009e73")) # color blind palette
final_plot</code></pre>
<p><img src="index_files/figure-html/unnamed-chunk-15-1.png" width="672" /></p>
<div id="exporting-the-plot" class="section level4">
<h4>Exporting the plot</h4>
<p>The plot can be exported as a png file like so:</p>
<pre class="r"><code>ggsave(filename = "qpcr.png", final_plot, dpi = 600)</code></pre>
<p>There are other formats that can be used as well. Please read the documentation <a href="https://ggplot2.tidyverse.org/reference/ggsave.html">here</a>. <br><br></p>
</div>
</div>
<div id="references" class="section level3">
<h3>References</h3>
<ol style="list-style-type: decimal">
<li>Kenneth J. Livak, Thomas D. Schmittgen, Analysis of Relative Gene Expression Data Using Real-Time Quantitative PCR and the 2−ΔΔCT Method, Methods, Volume 25, Issue 4, 2001, Pages 402-408, ISSN 1046-2023, <a href="https://doi.org/10.1006/meth.2001.1262" class="uri">https://doi.org/10.1006/meth.2001.1262</a>.</li>
</ol>
<p><br><br></p>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.odd').parent('tbody').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open');
});
});
</script>
<!-- code folding -->
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>