-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercises.html
852 lines (811 loc) · 100 KB
/
exercises.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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>2.10 Exercises | Computational Genomics with R</title>
<meta name="description" content="A guide to computationa genomics using R. The book covers fundemental topics with practical examples for an interdisciplinery audience" />
<meta name="generator" content="bookdown 0.19 and GitBook 2.6.7" />
<meta property="og:title" content="2.10 Exercises | Computational Genomics with R" />
<meta property="og:type" content="book" />
<meta property="og:url" content="https://compmgenomr.github.io/book/" />
<meta property="og:image" content="https://compmgenomr.github.io/book/images/cover.jpg" />
<meta property="og:description" content="A guide to computationa genomics using R. The book covers fundemental topics with practical examples for an interdisciplinery audience" />
<meta name="github-repo" content="compgenomr/book" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="2.10 Exercises | Computational Genomics with R" />
<meta name="twitter:description" content="A guide to computationa genomics using R. The book covers fundemental topics with practical examples for an interdisciplinery audience" />
<meta name="twitter:image" content="https://compmgenomr.github.io/book/images/cover.jpg" />
<meta name="author" content="Altuna Akalin" />
<meta name="date" content="2020-09-30" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="prev" href="functions-and-control-structures-for-ifelse-etc-.html"/>
<link rel="next" href="stats.html"/>
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-83786243-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-83786243-1');
</script>
<style type="text/css">
code.sourceCode > span { display: inline-block; line-height: 1.25; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li><a href="./">Computational Genomics with R</a></li>
<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>Preface</a><ul>
<li class="chapter" data-level="" data-path="who-is-this-book-for.html"><a href="who-is-this-book-for.html"><i class="fa fa-check"></i>Who is this book for?</a><ul>
<li class="chapter" data-level="" data-path="who-is-this-book-for.html"><a href="who-is-this-book-for.html#what-will-you-get-out-of-this"><i class="fa fa-check"></i>What will you get out of this?</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="structure-of-the-book.html"><a href="structure-of-the-book.html"><i class="fa fa-check"></i>Structure of the book</a></li>
<li class="chapter" data-level="" data-path="software-information-and-conventions.html"><a href="software-information-and-conventions.html"><i class="fa fa-check"></i>Software information and conventions</a><ul>
<li class="chapter" data-level="" data-path="software-information-and-conventions.html"><a href="software-information-and-conventions.html#assignment-operator-convention"><i class="fa fa-check"></i>Assignment operator convention</a></li>
<li class="chapter" data-level="" data-path="software-information-and-conventions.html"><a href="software-information-and-conventions.html#packages-needed-to-run-the-book-code"><i class="fa fa-check"></i>Packages needed to run the book code</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="data-for-the-book.html"><a href="data-for-the-book.html"><i class="fa fa-check"></i>Data for the book</a></li>
<li class="chapter" data-level="" data-path="exercises-in-the-book.html"><a href="exercises-in-the-book.html"><i class="fa fa-check"></i>Exercises in the book</a></li>
<li class="chapter" data-level="" data-path="reproducibility-statement.html"><a href="reproducibility-statement.html"><i class="fa fa-check"></i>Reproducibility statement</a></li>
<li class="chapter" data-level="" data-path="acknowledgements.html"><a href="acknowledgements.html"><i class="fa fa-check"></i>Acknowledgements</a></li>
<li class="chapter" data-level="" data-path="how-to-contribute.html"><a href="how-to-contribute.html"><i class="fa fa-check"></i>How to contribute</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="about-the-authors.html"><a href="about-the-authors.html"><i class="fa fa-check"></i>About the Authors</a></li>
<li class="chapter" data-level="1" data-path="intro.html"><a href="intro.html"><i class="fa fa-check"></i><b>1</b> Introduction to Genomics</a><ul>
<li class="chapter" data-level="1.1" data-path="genes-dna-and-central-dogma.html"><a href="genes-dna-and-central-dogma.html"><i class="fa fa-check"></i><b>1.1</b> Genes, DNA and central dogma</a><ul>
<li class="chapter" data-level="1.1.1" data-path="genes-dna-and-central-dogma.html"><a href="genes-dna-and-central-dogma.html#what-is-a-genome"><i class="fa fa-check"></i><b>1.1.1</b> What is a genome?</a></li>
<li class="chapter" data-level="1.1.2" data-path="genes-dna-and-central-dogma.html"><a href="genes-dna-and-central-dogma.html#what-is-a-gene"><i class="fa fa-check"></i><b>1.1.2</b> What is a gene?</a></li>
<li class="chapter" data-level="1.1.3" data-path="genes-dna-and-central-dogma.html"><a href="genes-dna-and-central-dogma.html#how-are-genes-controlled-transcriptional-and-post-transcriptional-regulation"><i class="fa fa-check"></i><b>1.1.3</b> How are genes controlled? Transcriptional and post-transcriptional regulation</a></li>
<li class="chapter" data-level="1.1.4" data-path="genes-dna-and-central-dogma.html"><a href="genes-dna-and-central-dogma.html#what-does-a-gene-look-like"><i class="fa fa-check"></i><b>1.1.4</b> What does a gene look like?</a></li>
</ul></li>
<li class="chapter" data-level="1.2" data-path="elements-of-gene-regulation.html"><a href="elements-of-gene-regulation.html"><i class="fa fa-check"></i><b>1.2</b> Elements of gene regulation</a><ul>
<li class="chapter" data-level="1.2.1" data-path="elements-of-gene-regulation.html"><a href="elements-of-gene-regulation.html#transcriptional-regulation"><i class="fa fa-check"></i><b>1.2.1</b> Transcriptional regulation</a></li>
<li class="chapter" data-level="1.2.2" data-path="elements-of-gene-regulation.html"><a href="elements-of-gene-regulation.html#post-transcriptional-regulation"><i class="fa fa-check"></i><b>1.2.2</b> Post-transcriptional regulation</a></li>
</ul></li>
<li class="chapter" data-level="1.3" data-path="shaping-the-genome-dna-mutation.html"><a href="shaping-the-genome-dna-mutation.html"><i class="fa fa-check"></i><b>1.3</b> Shaping the genome: DNA mutation</a></li>
<li class="chapter" data-level="1.4" data-path="high-throughput-experimental-methods-in-genomics.html"><a href="high-throughput-experimental-methods-in-genomics.html"><i class="fa fa-check"></i><b>1.4</b> High-throughput experimental methods in genomics</a><ul>
<li class="chapter" data-level="1.4.1" data-path="high-throughput-experimental-methods-in-genomics.html"><a href="high-throughput-experimental-methods-in-genomics.html#the-general-idea-behind-high-throughput-techniques"><i class="fa fa-check"></i><b>1.4.1</b> The general idea behind high-throughput techniques</a></li>
<li class="chapter" data-level="1.4.2" data-path="high-throughput-experimental-methods-in-genomics.html"><a href="high-throughput-experimental-methods-in-genomics.html#high-throughput-sequencing"><i class="fa fa-check"></i><b>1.4.2</b> High-throughput sequencing</a></li>
</ul></li>
<li class="chapter" data-level="1.5" data-path="visualization-and-data-repositories-for-genomics.html"><a href="visualization-and-data-repositories-for-genomics.html"><i class="fa fa-check"></i><b>1.5</b> Visualization and data repositories for genomics</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="Rintro.html"><a href="Rintro.html"><i class="fa fa-check"></i><b>2</b> Introduction to R for Genomic Data Analysis</a><ul>
<li class="chapter" data-level="2.1" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html"><i class="fa fa-check"></i><b>2.1</b> Steps of (genomic) data analysis</a><ul>
<li class="chapter" data-level="2.1.1" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html#data-collection"><i class="fa fa-check"></i><b>2.1.1</b> Data collection</a></li>
<li class="chapter" data-level="2.1.2" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html#data-quality-check-and-cleaning"><i class="fa fa-check"></i><b>2.1.2</b> Data quality check and cleaning</a></li>
<li class="chapter" data-level="2.1.3" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html#data-processing"><i class="fa fa-check"></i><b>2.1.3</b> Data processing</a></li>
<li class="chapter" data-level="2.1.4" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html#exploratory-data-analysis-and-modeling"><i class="fa fa-check"></i><b>2.1.4</b> Exploratory data analysis and modeling</a></li>
<li class="chapter" data-level="2.1.5" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html#visualization-and-reporting"><i class="fa fa-check"></i><b>2.1.5</b> Visualization and reporting</a></li>
<li class="chapter" data-level="2.1.6" data-path="steps-of-genomic-data-analysis.html"><a href="steps-of-genomic-data-analysis.html#why-use-r-for-genomics"><i class="fa fa-check"></i><b>2.1.6</b> Why use R for genomics ?</a></li>
</ul></li>
<li class="chapter" data-level="2.2" data-path="getting-started-with-r.html"><a href="getting-started-with-r.html"><i class="fa fa-check"></i><b>2.2</b> Getting started with R</a><ul>
<li class="chapter" data-level="2.2.1" data-path="getting-started-with-r.html"><a href="getting-started-with-r.html#installing-packages"><i class="fa fa-check"></i><b>2.2.1</b> Installing packages</a></li>
<li class="chapter" data-level="2.2.2" data-path="getting-started-with-r.html"><a href="getting-started-with-r.html#installing-packages-in-custom-locations"><i class="fa fa-check"></i><b>2.2.2</b> Installing packages in custom locations</a></li>
<li class="chapter" data-level="2.2.3" data-path="getting-started-with-r.html"><a href="getting-started-with-r.html#getting-help-on-functions-and-packages"><i class="fa fa-check"></i><b>2.2.3</b> Getting help on functions and packages</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="computations-in-r.html"><a href="computations-in-r.html"><i class="fa fa-check"></i><b>2.3</b> Computations in R</a></li>
<li class="chapter" data-level="2.4" data-path="data-structures.html"><a href="data-structures.html"><i class="fa fa-check"></i><b>2.4</b> Data structures</a><ul>
<li class="chapter" data-level="2.4.1" data-path="data-structures.html"><a href="data-structures.html#vectors"><i class="fa fa-check"></i><b>2.4.1</b> Vectors</a></li>
<li class="chapter" data-level="2.4.2" data-path="data-structures.html"><a href="data-structures.html#matrices"><i class="fa fa-check"></i><b>2.4.2</b> Matrices</a></li>
<li class="chapter" data-level="2.4.3" data-path="data-structures.html"><a href="data-structures.html#data-frames"><i class="fa fa-check"></i><b>2.4.3</b> Data frames</a></li>
<li class="chapter" data-level="2.4.4" data-path="data-structures.html"><a href="data-structures.html#lists"><i class="fa fa-check"></i><b>2.4.4</b> Lists</a></li>
<li class="chapter" data-level="2.4.5" data-path="data-structures.html"><a href="data-structures.html#factors"><i class="fa fa-check"></i><b>2.4.5</b> Factors</a></li>
</ul></li>
<li class="chapter" data-level="2.5" data-path="data-types.html"><a href="data-types.html"><i class="fa fa-check"></i><b>2.5</b> Data types</a></li>
<li class="chapter" data-level="2.6" data-path="reading-and-writing-data.html"><a href="reading-and-writing-data.html"><i class="fa fa-check"></i><b>2.6</b> Reading and writing data</a><ul>
<li class="chapter" data-level="2.6.1" data-path="reading-and-writing-data.html"><a href="reading-and-writing-data.html#reading-large-files"><i class="fa fa-check"></i><b>2.6.1</b> Reading large files</a></li>
</ul></li>
<li class="chapter" data-level="2.7" data-path="plotting-in-r-with-base-graphics.html"><a href="plotting-in-r-with-base-graphics.html"><i class="fa fa-check"></i><b>2.7</b> Plotting in R with base graphics</a><ul>
<li class="chapter" data-level="2.7.1" data-path="plotting-in-r-with-base-graphics.html"><a href="plotting-in-r-with-base-graphics.html#combining-multiple-plots"><i class="fa fa-check"></i><b>2.7.1</b> Combining multiple plots</a></li>
<li class="chapter" data-level="2.7.2" data-path="plotting-in-r-with-base-graphics.html"><a href="plotting-in-r-with-base-graphics.html#saving-plots"><i class="fa fa-check"></i><b>2.7.2</b> Saving plots</a></li>
</ul></li>
<li class="chapter" data-level="2.8" data-path="plotting-in-r-with-ggplot2.html"><a href="plotting-in-r-with-ggplot2.html"><i class="fa fa-check"></i><b>2.8</b> Plotting in R with ggplot2</a><ul>
<li class="chapter" data-level="2.8.1" data-path="plotting-in-r-with-ggplot2.html"><a href="plotting-in-r-with-ggplot2.html#combining-multiple-plots-1"><i class="fa fa-check"></i><b>2.8.1</b> Combining multiple plots</a></li>
<li class="chapter" data-level="2.8.2" data-path="plotting-in-r-with-ggplot2.html"><a href="plotting-in-r-with-ggplot2.html#ggplot2-and-tidyverse"><i class="fa fa-check"></i><b>2.8.2</b> ggplot2 and tidyverse</a></li>
</ul></li>
<li class="chapter" data-level="2.9" data-path="functions-and-control-structures-for-ifelse-etc-.html"><a href="functions-and-control-structures-for-ifelse-etc-.html"><i class="fa fa-check"></i><b>2.9</b> Functions and control structures (for, if/else etc.)</a><ul>
<li class="chapter" data-level="2.9.1" data-path="functions-and-control-structures-for-ifelse-etc-.html"><a href="functions-and-control-structures-for-ifelse-etc-.html#user-defined-functions"><i class="fa fa-check"></i><b>2.9.1</b> User-defined functions</a></li>
<li class="chapter" data-level="2.9.2" data-path="functions-and-control-structures-for-ifelse-etc-.html"><a href="functions-and-control-structures-for-ifelse-etc-.html#loops-and-looping-structures-in-r"><i class="fa fa-check"></i><b>2.9.2</b> Loops and looping structures in R</a></li>
</ul></li>
<li class="chapter" data-level="2.10" data-path="exercises.html"><a href="exercises.html"><i class="fa fa-check"></i><b>2.10</b> Exercises</a><ul>
<li class="chapter" data-level="2.10.1" data-path="exercises.html"><a href="exercises.html#computations-in-r-1"><i class="fa fa-check"></i><b>2.10.1</b> Computations in R</a></li>
<li class="chapter" data-level="2.10.2" data-path="exercises.html"><a href="exercises.html#data-structures-in-r"><i class="fa fa-check"></i><b>2.10.2</b> Data structures in R</a></li>
<li class="chapter" data-level="2.10.3" data-path="exercises.html"><a href="exercises.html#reading-in-and-writing-data-out-in-r"><i class="fa fa-check"></i><b>2.10.3</b> Reading in and writing data out in R</a></li>
<li class="chapter" data-level="2.10.4" data-path="exercises.html"><a href="exercises.html#plotting-in-r"><i class="fa fa-check"></i><b>2.10.4</b> Plotting in R</a></li>
<li class="chapter" data-level="2.10.5" data-path="exercises.html"><a href="exercises.html#functions-and-control-structures-for-ifelse-etc.-1"><i class="fa fa-check"></i><b>2.10.5</b> Functions and control structures (for, if/else, etc.)</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="3" data-path="stats.html"><a href="stats.html"><i class="fa fa-check"></i><b>3</b> Statistics for Genomics</a><ul>
<li class="chapter" data-level="3.1" data-path="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html"><a href="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html"><i class="fa fa-check"></i><b>3.1</b> How to summarize collection of data points: The idea behind statistical distributions</a><ul>
<li class="chapter" data-level="3.1.1" data-path="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html"><a href="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html#describing-the-central-tendency-mean-and-median"><i class="fa fa-check"></i><b>3.1.1</b> Describing the central tendency: Mean and median</a></li>
<li class="chapter" data-level="3.1.2" data-path="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html"><a href="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html#describing-the-spread-measurements-of-variation"><i class="fa fa-check"></i><b>3.1.2</b> Describing the spread: Measurements of variation</a></li>
<li class="chapter" data-level="3.1.3" data-path="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html"><a href="how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions.html#precision-of-estimates-confidence-intervals"><i class="fa fa-check"></i><b>3.1.3</b> Precision of estimates: Confidence intervals</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="how-to-test-for-differences-between-samples.html"><a href="how-to-test-for-differences-between-samples.html"><i class="fa fa-check"></i><b>3.2</b> How to test for differences between samples</a><ul>
<li class="chapter" data-level="3.2.1" data-path="how-to-test-for-differences-between-samples.html"><a href="how-to-test-for-differences-between-samples.html#randomization-based-testing-for-difference-of-the-means"><i class="fa fa-check"></i><b>3.2.1</b> Randomization-based testing for difference of the means</a></li>
<li class="chapter" data-level="3.2.2" data-path="how-to-test-for-differences-between-samples.html"><a href="how-to-test-for-differences-between-samples.html#using-t-test-for-difference-of-the-means-between-two-samples"><i class="fa fa-check"></i><b>3.2.2</b> Using t-test for difference of the means between two samples</a></li>
<li class="chapter" data-level="3.2.3" data-path="how-to-test-for-differences-between-samples.html"><a href="how-to-test-for-differences-between-samples.html#multiple-testing-correction"><i class="fa fa-check"></i><b>3.2.3</b> Multiple testing correction</a></li>
<li class="chapter" data-level="3.2.4" data-path="how-to-test-for-differences-between-samples.html"><a href="how-to-test-for-differences-between-samples.html#moderated-t-tests-using-information-from-multiple-comparisons"><i class="fa fa-check"></i><b>3.2.4</b> Moderated t-tests: Using information from multiple comparisons</a></li>
</ul></li>
<li class="chapter" data-level="3.3" data-path="relationship-between-variables-linear-models-and-correlation.html"><a href="relationship-between-variables-linear-models-and-correlation.html"><i class="fa fa-check"></i><b>3.3</b> Relationship between variables: Linear models and correlation</a><ul>
<li class="chapter" data-level="3.3.1" data-path="relationship-between-variables-linear-models-and-correlation.html"><a href="relationship-between-variables-linear-models-and-correlation.html#how-to-fit-a-line"><i class="fa fa-check"></i><b>3.3.1</b> How to fit a line</a></li>
<li class="chapter" data-level="3.3.2" data-path="relationship-between-variables-linear-models-and-correlation.html"><a href="relationship-between-variables-linear-models-and-correlation.html#how-to-estimate-the-error-of-the-coefficients"><i class="fa fa-check"></i><b>3.3.2</b> How to estimate the error of the coefficients</a></li>
<li class="chapter" data-level="3.3.3" data-path="relationship-between-variables-linear-models-and-correlation.html"><a href="relationship-between-variables-linear-models-and-correlation.html#accuracy-of-the-model"><i class="fa fa-check"></i><b>3.3.3</b> Accuracy of the model</a></li>
<li class="chapter" data-level="3.3.4" data-path="relationship-between-variables-linear-models-and-correlation.html"><a href="relationship-between-variables-linear-models-and-correlation.html#regression-with-categorical-variables"><i class="fa fa-check"></i><b>3.3.4</b> Regression with categorical variables</a></li>
<li class="chapter" data-level="3.3.5" data-path="relationship-between-variables-linear-models-and-correlation.html"><a href="relationship-between-variables-linear-models-and-correlation.html#regression-pitfalls"><i class="fa fa-check"></i><b>3.3.5</b> Regression pitfalls</a></li>
</ul></li>
<li class="chapter" data-level="3.4" data-path="exercises-1.html"><a href="exercises-1.html"><i class="fa fa-check"></i><b>3.4</b> Exercises</a><ul>
<li class="chapter" data-level="3.4.1" data-path="exercises-1.html"><a href="exercises-1.html#how-to-summarize-collection-of-data-points-the-idea-behind-statistical-distributions-1"><i class="fa fa-check"></i><b>3.4.1</b> How to summarize collection of data points: The idea behind statistical distributions</a></li>
<li class="chapter" data-level="3.4.2" data-path="exercises-1.html"><a href="exercises-1.html#how-to-test-for-differences-in-samples"><i class="fa fa-check"></i><b>3.4.2</b> How to test for differences in samples</a></li>
<li class="chapter" data-level="3.4.3" data-path="exercises-1.html"><a href="exercises-1.html#relationship-between-variables-linear-models-and-correlation-1"><i class="fa fa-check"></i><b>3.4.3</b> Relationship between variables: Linear models and correlation</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="4" data-path="unsupervisedLearning.html"><a href="unsupervisedLearning.html"><i class="fa fa-check"></i><b>4</b> Exploratory Data Analysis with Unsupervised Machine Learning</a><ul>
<li class="chapter" data-level="4.1" data-path="clustering-grouping-samples-based-on-their-similarity.html"><a href="clustering-grouping-samples-based-on-their-similarity.html"><i class="fa fa-check"></i><b>4.1</b> Clustering: Grouping samples based on their similarity</a><ul>
<li class="chapter" data-level="4.1.1" data-path="clustering-grouping-samples-based-on-their-similarity.html"><a href="clustering-grouping-samples-based-on-their-similarity.html#distance-metrics"><i class="fa fa-check"></i><b>4.1.1</b> Distance metrics</a></li>
<li class="chapter" data-level="4.1.2" data-path="clustering-grouping-samples-based-on-their-similarity.html"><a href="clustering-grouping-samples-based-on-their-similarity.html#hiearchical-clustering"><i class="fa fa-check"></i><b>4.1.2</b> Hiearchical clustering</a></li>
<li class="chapter" data-level="4.1.3" data-path="clustering-grouping-samples-based-on-their-similarity.html"><a href="clustering-grouping-samples-based-on-their-similarity.html#k-means-clustering"><i class="fa fa-check"></i><b>4.1.3</b> K-means clustering</a></li>
<li class="chapter" data-level="4.1.4" data-path="clustering-grouping-samples-based-on-their-similarity.html"><a href="clustering-grouping-samples-based-on-their-similarity.html#how-to-choose-k-the-number-of-clusters"><i class="fa fa-check"></i><b>4.1.4</b> How to choose “k”, the number of clusters</a></li>
</ul></li>
<li class="chapter" data-level="4.2" data-path="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html"><a href="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html"><i class="fa fa-check"></i><b>4.2</b> Dimensionality reduction techniques: Visualizing complex data sets in 2D</a><ul>
<li class="chapter" data-level="4.2.1" data-path="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html"><a href="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html#principal-component-analysis"><i class="fa fa-check"></i><b>4.2.1</b> Principal component analysis</a></li>
<li class="chapter" data-level="4.2.2" data-path="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html"><a href="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html#other-matrix-factorization-methods-for-dimensionality-reduction"><i class="fa fa-check"></i><b>4.2.2</b> Other matrix factorization methods for dimensionality reduction</a></li>
<li class="chapter" data-level="4.2.3" data-path="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html"><a href="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html#multi-dimensional-scaling"><i class="fa fa-check"></i><b>4.2.3</b> Multi-dimensional scaling</a></li>
<li class="chapter" data-level="4.2.4" data-path="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html"><a href="dimensionality-reduction-techniques-visualizing-complex-data-sets-in-2d.html#t-distributed-stochastic-neighbor-embedding-t-sne"><i class="fa fa-check"></i><b>4.2.4</b> t-Distributed Stochastic Neighbor Embedding (t-SNE)</a></li>
</ul></li>
<li class="chapter" data-level="4.3" data-path="exercises-2.html"><a href="exercises-2.html"><i class="fa fa-check"></i><b>4.3</b> Exercises</a><ul>
<li class="chapter" data-level="4.3.1" data-path="exercises-2.html"><a href="exercises-2.html#clustering"><i class="fa fa-check"></i><b>4.3.1</b> Clustering</a></li>
<li class="chapter" data-level="4.3.2" data-path="exercises-2.html"><a href="exercises-2.html#dimension-reduction"><i class="fa fa-check"></i><b>4.3.2</b> Dimension reduction</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="5" data-path="supervisedLearning.html"><a href="supervisedLearning.html"><i class="fa fa-check"></i><b>5</b> Predictive Modeling with Supervised Machine Learning</a><ul>
<li class="chapter" data-level="5.1" data-path="how-are-machine-learning-models-fit.html"><a href="how-are-machine-learning-models-fit.html"><i class="fa fa-check"></i><b>5.1</b> How are machine learning models fit?</a><ul>
<li class="chapter" data-level="5.1.1" data-path="how-are-machine-learning-models-fit.html"><a href="how-are-machine-learning-models-fit.html#machine-learning-vs.-statistics"><i class="fa fa-check"></i><b>5.1.1</b> Machine learning vs. statistics</a></li>
</ul></li>
<li class="chapter" data-level="5.2" data-path="steps-in-supervised-machine-learning.html"><a href="steps-in-supervised-machine-learning.html"><i class="fa fa-check"></i><b>5.2</b> Steps in supervised machine learning</a></li>
<li class="chapter" data-level="5.3" data-path="use-case-disease-subtype-from-genomics-data.html"><a href="use-case-disease-subtype-from-genomics-data.html"><i class="fa fa-check"></i><b>5.3</b> Use case: Disease subtype from genomics data</a></li>
<li class="chapter" data-level="5.4" data-path="data-preprocessing.html"><a href="data-preprocessing.html"><i class="fa fa-check"></i><b>5.4</b> Data preprocessing</a><ul>
<li class="chapter" data-level="5.4.1" data-path="data-preprocessing.html"><a href="data-preprocessing.html#data-transformation"><i class="fa fa-check"></i><b>5.4.1</b> Data transformation</a></li>
<li class="chapter" data-level="5.4.2" data-path="data-preprocessing.html"><a href="data-preprocessing.html#filtering-data-and-scaling"><i class="fa fa-check"></i><b>5.4.2</b> Filtering data and scaling</a></li>
<li class="chapter" data-level="5.4.3" data-path="data-preprocessing.html"><a href="data-preprocessing.html#dealing-with-missing-values"><i class="fa fa-check"></i><b>5.4.3</b> Dealing with missing values</a></li>
</ul></li>
<li class="chapter" data-level="5.5" data-path="splitting-the-data.html"><a href="splitting-the-data.html"><i class="fa fa-check"></i><b>5.5</b> Splitting the data</a><ul>
<li class="chapter" data-level="5.5.1" data-path="splitting-the-data.html"><a href="splitting-the-data.html#holdout-test-dataset"><i class="fa fa-check"></i><b>5.5.1</b> Holdout test dataset</a></li>
<li class="chapter" data-level="5.5.2" data-path="splitting-the-data.html"><a href="splitting-the-data.html#cross-validation"><i class="fa fa-check"></i><b>5.5.2</b> Cross-validation</a></li>
<li class="chapter" data-level="5.5.3" data-path="splitting-the-data.html"><a href="splitting-the-data.html#bootstrap-resampling"><i class="fa fa-check"></i><b>5.5.3</b> Bootstrap resampling</a></li>
</ul></li>
<li class="chapter" data-level="5.6" data-path="predicting-the-subtype-with-k-nearest-neighbors.html"><a href="predicting-the-subtype-with-k-nearest-neighbors.html"><i class="fa fa-check"></i><b>5.6</b> Predicting the subtype with k-nearest neighbors</a></li>
<li class="chapter" data-level="5.7" data-path="assessing-the-performance-of-our-model.html"><a href="assessing-the-performance-of-our-model.html"><i class="fa fa-check"></i><b>5.7</b> Assessing the performance of our model</a><ul>
<li class="chapter" data-level="5.7.1" data-path="assessing-the-performance-of-our-model.html"><a href="assessing-the-performance-of-our-model.html#receiver-operating-characteristic-roc-curves"><i class="fa fa-check"></i><b>5.7.1</b> Receiver Operating Characteristic (ROC) curves</a></li>
</ul></li>
<li class="chapter" data-level="5.8" data-path="model-tuning-and-avoiding-overfitting.html"><a href="model-tuning-and-avoiding-overfitting.html"><i class="fa fa-check"></i><b>5.8</b> Model tuning and avoiding overfitting</a><ul>
<li class="chapter" data-level="5.8.1" data-path="model-tuning-and-avoiding-overfitting.html"><a href="model-tuning-and-avoiding-overfitting.html#model-complexity-and-bias-variance-trade-off"><i class="fa fa-check"></i><b>5.8.1</b> Model complexity and bias variance trade-off</a></li>
<li class="chapter" data-level="5.8.2" data-path="model-tuning-and-avoiding-overfitting.html"><a href="model-tuning-and-avoiding-overfitting.html#data-split-strategies-for-model-tuning-and-testing"><i class="fa fa-check"></i><b>5.8.2</b> Data split strategies for model tuning and testing</a></li>
</ul></li>
<li class="chapter" data-level="5.9" data-path="variable-importance.html"><a href="variable-importance.html"><i class="fa fa-check"></i><b>5.9</b> Variable importance</a></li>
<li class="chapter" data-level="5.10" data-path="how-to-deal-with-class-imbalance.html"><a href="how-to-deal-with-class-imbalance.html"><i class="fa fa-check"></i><b>5.10</b> How to deal with class imbalance</a><ul>
<li class="chapter" data-level="5.10.1" data-path="how-to-deal-with-class-imbalance.html"><a href="how-to-deal-with-class-imbalance.html#sampling-for-class-balance"><i class="fa fa-check"></i><b>5.10.1</b> Sampling for class balance</a></li>
<li class="chapter" data-level="5.10.2" data-path="how-to-deal-with-class-imbalance.html"><a href="how-to-deal-with-class-imbalance.html#altering-case-weights"><i class="fa fa-check"></i><b>5.10.2</b> Altering case weights</a></li>
<li class="chapter" data-level="5.10.3" data-path="how-to-deal-with-class-imbalance.html"><a href="how-to-deal-with-class-imbalance.html#selecting-different-classification-score-cutoffs"><i class="fa fa-check"></i><b>5.10.3</b> Selecting different classification score cutoffs</a></li>
</ul></li>
<li class="chapter" data-level="5.11" data-path="dealing-with-correlated-predictors.html"><a href="dealing-with-correlated-predictors.html"><i class="fa fa-check"></i><b>5.11</b> Dealing with correlated predictors</a></li>
<li class="chapter" data-level="5.12" data-path="trees-and-forests-random-forests-in-action.html"><a href="trees-and-forests-random-forests-in-action.html"><i class="fa fa-check"></i><b>5.12</b> Trees and forests: Random forests in action</a><ul>
<li class="chapter" data-level="5.12.1" data-path="trees-and-forests-random-forests-in-action.html"><a href="trees-and-forests-random-forests-in-action.html#decision-trees"><i class="fa fa-check"></i><b>5.12.1</b> Decision trees</a></li>
<li class="chapter" data-level="5.12.2" data-path="trees-and-forests-random-forests-in-action.html"><a href="trees-and-forests-random-forests-in-action.html#trees-to-forests"><i class="fa fa-check"></i><b>5.12.2</b> Trees to forests</a></li>
<li class="chapter" data-level="5.12.3" data-path="trees-and-forests-random-forests-in-action.html"><a href="trees-and-forests-random-forests-in-action.html#variable-importance-1"><i class="fa fa-check"></i><b>5.12.3</b> Variable importance</a></li>
</ul></li>
<li class="chapter" data-level="5.13" data-path="logistic-regression-and-regularization.html"><a href="logistic-regression-and-regularization.html"><i class="fa fa-check"></i><b>5.13</b> Logistic regression and regularization</a><ul>
<li class="chapter" data-level="5.13.1" data-path="logistic-regression-and-regularization.html"><a href="logistic-regression-and-regularization.html#regularization-in-order-to-avoid-overfitting"><i class="fa fa-check"></i><b>5.13.1</b> Regularization in order to avoid overfitting</a></li>
<li class="chapter" data-level="5.13.2" data-path="logistic-regression-and-regularization.html"><a href="logistic-regression-and-regularization.html#variable-importance-2"><i class="fa fa-check"></i><b>5.13.2</b> Variable importance</a></li>
</ul></li>
<li class="chapter" data-level="5.14" data-path="other-supervised-algorithms.html"><a href="other-supervised-algorithms.html"><i class="fa fa-check"></i><b>5.14</b> Other supervised algorithms</a><ul>
<li class="chapter" data-level="5.14.1" data-path="other-supervised-algorithms.html"><a href="other-supervised-algorithms.html#gradient-boosting"><i class="fa fa-check"></i><b>5.14.1</b> Gradient boosting</a></li>
<li class="chapter" data-level="5.14.2" data-path="other-supervised-algorithms.html"><a href="other-supervised-algorithms.html#support-vector-machines-svm"><i class="fa fa-check"></i><b>5.14.2</b> Support Vector Machines (SVM)</a></li>
<li class="chapter" data-level="5.14.3" data-path="other-supervised-algorithms.html"><a href="other-supervised-algorithms.html#neural-networks-and-deep-versions-of-it"><i class="fa fa-check"></i><b>5.14.3</b> Neural networks and deep versions of it</a></li>
<li class="chapter" data-level="5.14.4" data-path="other-supervised-algorithms.html"><a href="other-supervised-algorithms.html#ensemble-learning"><i class="fa fa-check"></i><b>5.14.4</b> Ensemble learning</a></li>
</ul></li>
<li class="chapter" data-level="5.15" data-path="predicting-continuous-variables-regression-with-machine-learning.html"><a href="predicting-continuous-variables-regression-with-machine-learning.html"><i class="fa fa-check"></i><b>5.15</b> Predicting continuous variables: Regression with machine learning</a><ul>
<li class="chapter" data-level="5.15.1" data-path="predicting-continuous-variables-regression-with-machine-learning.html"><a href="predicting-continuous-variables-regression-with-machine-learning.html#use-case-predicting-age-from-dna-methylation"><i class="fa fa-check"></i><b>5.15.1</b> Use case: Predicting age from DNA methylation</a></li>
<li class="chapter" data-level="5.15.2" data-path="predicting-continuous-variables-regression-with-machine-learning.html"><a href="predicting-continuous-variables-regression-with-machine-learning.html#reading-and-processing-the-data"><i class="fa fa-check"></i><b>5.15.2</b> Reading and processing the data</a></li>
<li class="chapter" data-level="5.15.3" data-path="predicting-continuous-variables-regression-with-machine-learning.html"><a href="predicting-continuous-variables-regression-with-machine-learning.html#running-random-forest-regression"><i class="fa fa-check"></i><b>5.15.3</b> Running random forest regression</a></li>
</ul></li>
<li class="chapter" data-level="5.16" data-path="exercises-3.html"><a href="exercises-3.html"><i class="fa fa-check"></i><b>5.16</b> Exercises</a><ul>
<li class="chapter" data-level="5.16.1" data-path="exercises-3.html"><a href="exercises-3.html#classification"><i class="fa fa-check"></i><b>5.16.1</b> Classification</a></li>
<li class="chapter" data-level="5.16.2" data-path="exercises-3.html"><a href="exercises-3.html#regression"><i class="fa fa-check"></i><b>5.16.2</b> Regression</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="6" data-path="genomicIntervals.html"><a href="genomicIntervals.html"><i class="fa fa-check"></i><b>6</b> Operations on Genomic Intervals and Genome Arithmetic</a><ul>
<li class="chapter" data-level="6.1" data-path="operations-on-genomic-intervals-with-genomicranges-package.html"><a href="operations-on-genomic-intervals-with-genomicranges-package.html"><i class="fa fa-check"></i><b>6.1</b> Operations on genomic intervals with <code>GenomicRanges</code> package</a><ul>
<li class="chapter" data-level="6.1.1" data-path="operations-on-genomic-intervals-with-genomicranges-package.html"><a href="operations-on-genomic-intervals-with-genomicranges-package.html#how-to-create-and-manipulate-a-granges-object"><i class="fa fa-check"></i><b>6.1.1</b> How to create and manipulate a GRanges object</a></li>
<li class="chapter" data-level="6.1.2" data-path="operations-on-genomic-intervals-with-genomicranges-package.html"><a href="operations-on-genomic-intervals-with-genomicranges-package.html#getting-genomic-regions-into-r-as-granges-objects"><i class="fa fa-check"></i><b>6.1.2</b> Getting genomic regions into R as GRanges objects</a></li>
<li class="chapter" data-level="6.1.3" data-path="operations-on-genomic-intervals-with-genomicranges-package.html"><a href="operations-on-genomic-intervals-with-genomicranges-package.html#finding-regions-that-dodo-not-overlap-with-another-set-of-regions"><i class="fa fa-check"></i><b>6.1.3</b> Finding regions that do/do not overlap with another set of regions</a></li>
</ul></li>
<li class="chapter" data-level="6.2" data-path="dealing-with-mapped-high-throughput-sequencing-reads.html"><a href="dealing-with-mapped-high-throughput-sequencing-reads.html"><i class="fa fa-check"></i><b>6.2</b> Dealing with mapped high-throughput sequencing reads</a><ul>
<li class="chapter" data-level="6.2.1" data-path="dealing-with-mapped-high-throughput-sequencing-reads.html"><a href="dealing-with-mapped-high-throughput-sequencing-reads.html#counting-mapped-reads-for-a-set-of-regions"><i class="fa fa-check"></i><b>6.2.1</b> Counting mapped reads for a set of regions</a></li>
</ul></li>
<li class="chapter" data-level="6.3" data-path="dealing-with-continuous-scores-over-the-genome.html"><a href="dealing-with-continuous-scores-over-the-genome.html"><i class="fa fa-check"></i><b>6.3</b> Dealing with continuous scores over the genome</a><ul>
<li class="chapter" data-level="6.3.1" data-path="dealing-with-continuous-scores-over-the-genome.html"><a href="dealing-with-continuous-scores-over-the-genome.html#extracting-subsections-of-rle-and-rlelist-objects"><i class="fa fa-check"></i><b>6.3.1</b> Extracting subsections of Rle and RleList objects</a></li>
</ul></li>
<li class="chapter" data-level="6.4" data-path="genomic-intervals-with-more-information-summarizedexperiment-class.html"><a href="genomic-intervals-with-more-information-summarizedexperiment-class.html"><i class="fa fa-check"></i><b>6.4</b> Genomic intervals with more information: SummarizedExperiment class</a><ul>
<li class="chapter" data-level="6.4.1" data-path="genomic-intervals-with-more-information-summarizedexperiment-class.html"><a href="genomic-intervals-with-more-information-summarizedexperiment-class.html#create-a-summarizedexperiment-object"><i class="fa fa-check"></i><b>6.4.1</b> Create a SummarizedExperiment object</a></li>
<li class="chapter" data-level="6.4.2" data-path="genomic-intervals-with-more-information-summarizedexperiment-class.html"><a href="genomic-intervals-with-more-information-summarizedexperiment-class.html#subset-and-manipulate-the-summarizedexperiment-object"><i class="fa fa-check"></i><b>6.4.2</b> Subset and manipulate the SummarizedExperiment object</a></li>
</ul></li>
<li class="chapter" data-level="6.5" data-path="visualizing-and-summarizing-genomic-intervals.html"><a href="visualizing-and-summarizing-genomic-intervals.html"><i class="fa fa-check"></i><b>6.5</b> Visualizing and summarizing genomic intervals</a><ul>
<li class="chapter" data-level="6.5.1" data-path="visualizing-and-summarizing-genomic-intervals.html"><a href="visualizing-and-summarizing-genomic-intervals.html#visualizing-intervals-on-a-locus-of-interest"><i class="fa fa-check"></i><b>6.5.1</b> Visualizing intervals on a locus of interest</a></li>
<li class="chapter" data-level="6.5.2" data-path="visualizing-and-summarizing-genomic-intervals.html"><a href="visualizing-and-summarizing-genomic-intervals.html#summaries-of-genomic-intervals-on-multiple-loci"><i class="fa fa-check"></i><b>6.5.2</b> Summaries of genomic intervals on multiple loci</a></li>
<li class="chapter" data-level="6.5.3" data-path="visualizing-and-summarizing-genomic-intervals.html"><a href="visualizing-and-summarizing-genomic-intervals.html#making-karyograms-and-circos-plots"><i class="fa fa-check"></i><b>6.5.3</b> Making karyograms and circos plots</a></li>
</ul></li>
<li class="chapter" data-level="6.6" data-path="exercises-4.html"><a href="exercises-4.html"><i class="fa fa-check"></i><b>6.6</b> Exercises</a><ul>
<li class="chapter" data-level="6.6.1" data-path="exercises-4.html"><a href="exercises-4.html#operations-on-genomic-intervals-with-the-genomicranges-package"><i class="fa fa-check"></i><b>6.6.1</b> Operations on genomic intervals with the <code>GenomicRanges</code> package</a></li>
<li class="chapter" data-level="6.6.2" data-path="exercises-4.html"><a href="exercises-4.html#dealing-with-mapped-high-throughput-sequencing-reads-1"><i class="fa fa-check"></i><b>6.6.2</b> Dealing with mapped high-throughput sequencing reads</a></li>
<li class="chapter" data-level="6.6.3" data-path="exercises-4.html"><a href="exercises-4.html#dealing-with-contiguous-scores-over-the-genome"><i class="fa fa-check"></i><b>6.6.3</b> Dealing with contiguous scores over the genome</a></li>
<li class="chapter" data-level="6.6.4" data-path="exercises-4.html"><a href="exercises-4.html#visualizing-and-summarizing-genomic-intervals-1"><i class="fa fa-check"></i><b>6.6.4</b> Visualizing and summarizing genomic intervals</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="7" data-path="processingReads.html"><a href="processingReads.html"><i class="fa fa-check"></i><b>7</b> Quality Check, Processing and Alignment of High-throughput Sequencing Reads</a><ul>
<li class="chapter" data-level="7.1" data-path="fasta-and-fastq-formats.html"><a href="fasta-and-fastq-formats.html"><i class="fa fa-check"></i><b>7.1</b> FASTA and FASTQ formats</a></li>
<li class="chapter" data-level="7.2" data-path="quality-check-on-sequencing-reads.html"><a href="quality-check-on-sequencing-reads.html"><i class="fa fa-check"></i><b>7.2</b> Quality check on sequencing reads</a><ul>
<li class="chapter" data-level="7.2.1" data-path="quality-check-on-sequencing-reads.html"><a href="quality-check-on-sequencing-reads.html#sequence-quality-per-basecycle"><i class="fa fa-check"></i><b>7.2.1</b> Sequence quality per base/cycle</a></li>
<li class="chapter" data-level="7.2.2" data-path="quality-check-on-sequencing-reads.html"><a href="quality-check-on-sequencing-reads.html#sequence-content-per-basecycle"><i class="fa fa-check"></i><b>7.2.2</b> Sequence content per base/cycle</a></li>
<li class="chapter" data-level="7.2.3" data-path="quality-check-on-sequencing-reads.html"><a href="quality-check-on-sequencing-reads.html#read-frequency-plot"><i class="fa fa-check"></i><b>7.2.3</b> Read frequency plot</a></li>
<li class="chapter" data-level="7.2.4" data-path="quality-check-on-sequencing-reads.html"><a href="quality-check-on-sequencing-reads.html#other-quality-metrics-and-qc-tools"><i class="fa fa-check"></i><b>7.2.4</b> Other quality metrics and QC tools</a></li>
</ul></li>
<li class="chapter" data-level="7.3" data-path="filtering-and-trimming-reads.html"><a href="filtering-and-trimming-reads.html"><i class="fa fa-check"></i><b>7.3</b> Filtering and trimming reads</a></li>
<li class="chapter" data-level="7.4" data-path="mappingaligning-reads-to-the-genome.html"><a href="mappingaligning-reads-to-the-genome.html"><i class="fa fa-check"></i><b>7.4</b> Mapping/aligning reads to the genome</a></li>
<li class="chapter" data-level="7.5" data-path="further-processing-of-aligned-reads.html"><a href="further-processing-of-aligned-reads.html"><i class="fa fa-check"></i><b>7.5</b> Further processing of aligned reads</a></li>
<li class="chapter" data-level="7.6" data-path="exercises-5.html"><a href="exercises-5.html"><i class="fa fa-check"></i><b>7.6</b> Exercises</a></li>
</ul></li>
<li class="chapter" data-level="8" data-path="rnaseqanalysis.html"><a href="rnaseqanalysis.html"><i class="fa fa-check"></i><b>8</b> RNA-seq Analysis</a><ul>
<li class="chapter" data-level="8.1" data-path="what-is-gene-expression.html"><a href="what-is-gene-expression.html"><i class="fa fa-check"></i><b>8.1</b> What is gene expression?</a></li>
<li class="chapter" data-level="8.2" data-path="methods-to-detect-gene-expression.html"><a href="methods-to-detect-gene-expression.html"><i class="fa fa-check"></i><b>8.2</b> Methods to detect gene expression</a></li>
<li class="chapter" data-level="8.3" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><i class="fa fa-check"></i><b>8.3</b> Gene expression analysis using high-throughput sequencing technologies</a><ul>
<li class="chapter" data-level="8.3.1" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#processing-raw-data"><i class="fa fa-check"></i><b>8.3.1</b> Processing raw data</a></li>
<li class="chapter" data-level="8.3.2" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#alignment"><i class="fa fa-check"></i><b>8.3.2</b> Alignment</a></li>
<li class="chapter" data-level="8.3.3" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#quantification"><i class="fa fa-check"></i><b>8.3.3</b> Quantification</a></li>
<li class="chapter" data-level="8.3.4" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#within-sample-normalization-of-the-read-counts"><i class="fa fa-check"></i><b>8.3.4</b> Within sample normalization of the read counts</a></li>
<li class="chapter" data-level="8.3.5" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#computing-different-normalization-schemes-in-r"><i class="fa fa-check"></i><b>8.3.5</b> Computing different normalization schemes in R</a></li>
<li class="chapter" data-level="8.3.6" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#exploratory-analysis-of-the-read-count-table"><i class="fa fa-check"></i><b>8.3.6</b> Exploratory analysis of the read count table</a></li>
<li class="chapter" data-level="8.3.7" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#differential-expression-analysis"><i class="fa fa-check"></i><b>8.3.7</b> Differential expression analysis</a></li>
<li class="chapter" data-level="8.3.8" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#functional-enrichment-analysis"><i class="fa fa-check"></i><b>8.3.8</b> Functional enrichment analysis</a></li>
<li class="chapter" data-level="8.3.9" data-path="gene-expression-analysis-using-high-throughput-sequencing-technologies.html"><a href="gene-expression-analysis-using-high-throughput-sequencing-technologies.html#accounting-for-additional-sources-of-variation"><i class="fa fa-check"></i><b>8.3.9</b> Accounting for additional sources of variation</a></li>
</ul></li>
<li class="chapter" data-level="8.4" data-path="other-applications-of-rna-seq.html"><a href="other-applications-of-rna-seq.html"><i class="fa fa-check"></i><b>8.4</b> Other applications of RNA-seq</a></li>
<li class="chapter" data-level="8.5" data-path="exercises-6.html"><a href="exercises-6.html"><i class="fa fa-check"></i><b>8.5</b> Exercises</a><ul>
<li class="chapter" data-level="8.5.1" data-path="exercises-6.html"><a href="exercises-6.html#exploring-the-count-tables"><i class="fa fa-check"></i><b>8.5.1</b> Exploring the count tables</a></li>
<li class="chapter" data-level="8.5.2" data-path="exercises-6.html"><a href="exercises-6.html#differential-expression-analysis-1"><i class="fa fa-check"></i><b>8.5.2</b> Differential expression analysis</a></li>
<li class="chapter" data-level="8.5.3" data-path="exercises-6.html"><a href="exercises-6.html#functional-enrichment-analysis-1"><i class="fa fa-check"></i><b>8.5.3</b> Functional enrichment analysis</a></li>
<li class="chapter" data-level="8.5.4" data-path="exercises-6.html"><a href="exercises-6.html#removing-unwanted-variation-from-the-expression-data"><i class="fa fa-check"></i><b>8.5.4</b> Removing unwanted variation from the expression data</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="9" data-path="chipseq.html"><a href="chipseq.html"><i class="fa fa-check"></i><b>9</b> ChIP-seq analysis</a><ul>
<li class="chapter" data-level="9.1" data-path="regulatory-protein-dna-interactions.html"><a href="regulatory-protein-dna-interactions.html"><i class="fa fa-check"></i><b>9.1</b> Regulatory protein-DNA interactions</a></li>
<li class="chapter" data-level="9.2" data-path="measuring-protein-dna-interactions-with-chip-seq.html"><a href="measuring-protein-dna-interactions-with-chip-seq.html"><i class="fa fa-check"></i><b>9.2</b> Measuring protein-DNA interactions with ChIP-seq</a></li>
<li class="chapter" data-level="9.3" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><i class="fa fa-check"></i><b>9.3</b> Factors that affect ChIP-seq experiment and analysis quality</a><ul>
<li class="chapter" data-level="9.3.1" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html#antibody-specificity"><i class="fa fa-check"></i><b>9.3.1</b> Antibody specificity</a></li>
<li class="chapter" data-level="9.3.2" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html#sequencing-depth"><i class="fa fa-check"></i><b>9.3.2</b> Sequencing depth</a></li>
<li class="chapter" data-level="9.3.3" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html#pcr-duplication"><i class="fa fa-check"></i><b>9.3.3</b> PCR duplication</a></li>
<li class="chapter" data-level="9.3.4" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html#biological-replicates"><i class="fa fa-check"></i><b>9.3.4</b> Biological replicates</a></li>
<li class="chapter" data-level="9.3.5" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html#control-experiments"><i class="fa fa-check"></i><b>9.3.5</b> Control experiments</a></li>
<li class="chapter" data-level="9.3.6" data-path="factors-that-affect-chip-seq-experiment-and-analysis-quality.html"><a href="factors-that-affect-chip-seq-experiment-and-analysis-quality.html#using-tagged-proteins"><i class="fa fa-check"></i><b>9.3.6</b> Using tagged proteins</a></li>
</ul></li>
<li class="chapter" data-level="9.4" data-path="pre-processing-chip-data.html"><a href="pre-processing-chip-data.html"><i class="fa fa-check"></i><b>9.4</b> Pre-processing ChIP data</a><ul>
<li class="chapter" data-level="9.4.1" data-path="pre-processing-chip-data.html"><a href="pre-processing-chip-data.html#mapping-of-chip-seq-data"><i class="fa fa-check"></i><b>9.4.1</b> Mapping of ChIP-seq data</a></li>
</ul></li>
<li class="chapter" data-level="9.5" data-path="chip-quality-control.html"><a href="chip-quality-control.html"><i class="fa fa-check"></i><b>9.5</b> ChIP quality control</a><ul>
<li class="chapter" data-level="9.5.1" data-path="chip-quality-control.html"><a href="chip-quality-control.html#the-data"><i class="fa fa-check"></i><b>9.5.1</b> The data</a></li>
<li class="chapter" data-level="9.5.2" data-path="chip-quality-control.html"><a href="chip-quality-control.html#sample-clustering"><i class="fa fa-check"></i><b>9.5.2</b> Sample clustering</a></li>
<li class="chapter" data-level="9.5.3" data-path="chip-quality-control.html"><a href="chip-quality-control.html#visualization-in-the-genome-browser"><i class="fa fa-check"></i><b>9.5.3</b> Visualization in the genome browser</a></li>
<li class="chapter" data-level="9.5.4" data-path="chip-quality-control.html"><a href="chip-quality-control.html#plus-and-minus-strand-cross-correlation"><i class="fa fa-check"></i><b>9.5.4</b> Plus and minus strand cross-correlation</a></li>
<li class="chapter" data-level="9.5.5" data-path="chip-quality-control.html"><a href="chip-quality-control.html#gc-bias-quantification"><i class="fa fa-check"></i><b>9.5.5</b> GC bias quantification</a></li>
<li class="chapter" data-level="9.5.6" data-path="chip-quality-control.html"><a href="chip-quality-control.html#sequence-read-genomic-distribution"><i class="fa fa-check"></i><b>9.5.6</b> Sequence read genomic distribution</a></li>
</ul></li>
<li class="chapter" data-level="9.6" data-path="peak-calling.html"><a href="peak-calling.html"><i class="fa fa-check"></i><b>9.6</b> Peak calling</a><ul>
<li class="chapter" data-level="9.6.1" data-path="peak-calling.html"><a href="peak-calling.html#types-of-chip-seq-experiments"><i class="fa fa-check"></i><b>9.6.1</b> Types of ChIP-seq experiments</a></li>
<li class="chapter" data-level="9.6.2" data-path="peak-calling.html"><a href="peak-calling.html#peak-calling-sharp-peaks"><i class="fa fa-check"></i><b>9.6.2</b> Peak calling: Sharp peaks</a></li>
<li class="chapter" data-level="9.6.3" data-path="peak-calling.html"><a href="peak-calling.html#peak-calling-broad-regions"><i class="fa fa-check"></i><b>9.6.3</b> Peak calling: Broad regions</a></li>
<li class="chapter" data-level="9.6.4" data-path="peak-calling.html"><a href="peak-calling.html#peak-quality-control"><i class="fa fa-check"></i><b>9.6.4</b> Peak quality control</a></li>
<li class="chapter" data-level="9.6.5" data-path="peak-calling.html"><a href="peak-calling.html#peak-annotation"><i class="fa fa-check"></i><b>9.6.5</b> Peak annotation</a></li>
</ul></li>
<li class="chapter" data-level="9.7" data-path="motif-discovery.html"><a href="motif-discovery.html"><i class="fa fa-check"></i><b>9.7</b> Motif discovery</a><ul>
<li class="chapter" data-level="9.7.1" data-path="motif-discovery.html"><a href="motif-discovery.html#motif-comparison"><i class="fa fa-check"></i><b>9.7.1</b> Motif comparison</a></li>
</ul></li>
<li class="chapter" data-level="9.8" data-path="what-to-do-next.html"><a href="what-to-do-next.html"><i class="fa fa-check"></i><b>9.8</b> What to do next?</a></li>
<li class="chapter" data-level="9.9" data-path="exercises-7.html"><a href="exercises-7.html"><i class="fa fa-check"></i><b>9.9</b> Exercises</a><ul>
<li class="chapter" data-level="9.9.1" data-path="exercises-7.html"><a href="exercises-7.html#quality-control"><i class="fa fa-check"></i><b>9.9.1</b> Quality control</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="10" data-path="bsseq.html"><a href="bsseq.html"><i class="fa fa-check"></i><b>10</b> DNA methylation analysis using bisulfite sequencing data</a><ul>
<li class="chapter" data-level="10.1" data-path="what-is-dna-methylation.html"><a href="what-is-dna-methylation.html"><i class="fa fa-check"></i><b>10.1</b> What is DNA methylation?</a><ul>
<li class="chapter" data-level="10.1.1" data-path="what-is-dna-methylation.html"><a href="what-is-dna-methylation.html#how-dna-methylation-is-set"><i class="fa fa-check"></i><b>10.1.1</b> How DNA methylation is set ?</a></li>
<li class="chapter" data-level="10.1.2" data-path="what-is-dna-methylation.html"><a href="what-is-dna-methylation.html#how-to-measure-dna-methylation-with-bisulfite-sequencing"><i class="fa fa-check"></i><b>10.1.2</b> How to measure DNA methylation with bisulfite sequencing</a></li>
</ul></li>
<li class="chapter" data-level="10.2" data-path="analyzing-dna-methylation-data.html"><a href="analyzing-dna-methylation-data.html"><i class="fa fa-check"></i><b>10.2</b> Analyzing DNA methylation data</a></li>
<li class="chapter" data-level="10.3" data-path="processing-raw-data-and-getting-data-into-r.html"><a href="processing-raw-data-and-getting-data-into-r.html"><i class="fa fa-check"></i><b>10.3</b> Processing raw data and getting data into R</a></li>
<li class="chapter" data-level="10.4" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html"><i class="fa fa-check"></i><b>10.4</b> Data filtering and exploratory analysis</a><ul>
<li class="chapter" data-level="10.4.1" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html#reading-methylation-call-files"><i class="fa fa-check"></i><b>10.4.1</b> Reading methylation call files</a></li>
<li class="chapter" data-level="10.4.2" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html#further-quality-check"><i class="fa fa-check"></i><b>10.4.2</b> Further quality check</a></li>
<li class="chapter" data-level="10.4.3" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html#merging-samples-into-a-single-table"><i class="fa fa-check"></i><b>10.4.3</b> Merging samples into a single table</a></li>
<li class="chapter" data-level="10.4.4" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html#filtering-cpgs"><i class="fa fa-check"></i><b>10.4.4</b> Filtering CpGs</a></li>
<li class="chapter" data-level="10.4.5" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html#clustering-samples"><i class="fa fa-check"></i><b>10.4.5</b> Clustering samples</a></li>
<li class="chapter" data-level="10.4.6" data-path="data-filtering-and-exploratory-analysis.html"><a href="data-filtering-and-exploratory-analysis.html#principal-component-analysis-1"><i class="fa fa-check"></i><b>10.4.6</b> Principal component analysis</a></li>
</ul></li>
<li class="chapter" data-level="10.5" data-path="extracting-interesting-regions-differential-methylation-and-segmentation.html"><a href="extracting-interesting-regions-differential-methylation-and-segmentation.html"><i class="fa fa-check"></i><b>10.5</b> Extracting interesting regions: Differential methylation and segmentation</a><ul>
<li class="chapter" data-level="10.5.1" data-path="extracting-interesting-regions-differential-methylation-and-segmentation.html"><a href="extracting-interesting-regions-differential-methylation-and-segmentation.html#differential-methylation"><i class="fa fa-check"></i><b>10.5.1</b> Differential methylation</a></li>
<li class="chapter" data-level="10.5.2" data-path="extracting-interesting-regions-differential-methylation-and-segmentation.html"><a href="extracting-interesting-regions-differential-methylation-and-segmentation.html#methylation-segmentation"><i class="fa fa-check"></i><b>10.5.2</b> Methylation segmentation</a></li>
<li class="chapter" data-level="10.5.3" data-path="extracting-interesting-regions-differential-methylation-and-segmentation.html"><a href="extracting-interesting-regions-differential-methylation-and-segmentation.html#working-with-large-files"><i class="fa fa-check"></i><b>10.5.3</b> Working with large files</a></li>
</ul></li>
<li class="chapter" data-level="10.6" data-path="annotation-of-dmrsdmcs-and-segments.html"><a href="annotation-of-dmrsdmcs-and-segments.html"><i class="fa fa-check"></i><b>10.6</b> Annotation of DMRs/DMCs and segments</a><ul>
<li class="chapter" data-level="10.6.1" data-path="annotation-of-dmrsdmcs-and-segments.html"><a href="annotation-of-dmrsdmcs-and-segments.html#further-annotation-with-genes-or-gene-sets"><i class="fa fa-check"></i><b>10.6.1</b> Further annotation with genes or gene sets</a></li>
</ul></li>
<li class="chapter" data-level="10.7" data-path="other-r-packages-that-can-be-used-for-methylation-analysis.html"><a href="other-r-packages-that-can-be-used-for-methylation-analysis.html"><i class="fa fa-check"></i><b>10.7</b> Other R packages that can be used for methylation analysis</a></li>
<li class="chapter" data-level="10.8" data-path="exercises-8.html"><a href="exercises-8.html"><i class="fa fa-check"></i><b>10.8</b> Exercises</a><ul>
<li class="chapter" data-level="10.8.1" data-path="exercises-8.html"><a href="exercises-8.html#differential-methylation-1"><i class="fa fa-check"></i><b>10.8.1</b> Differential methylation</a></li>
<li class="chapter" data-level="10.8.2" data-path="exercises-8.html"><a href="exercises-8.html#methylome-segmentation"><i class="fa fa-check"></i><b>10.8.2</b> Methylome segmentation</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="11" data-path="multiomics.html"><a href="multiomics.html"><i class="fa fa-check"></i><b>11</b> Multi-omics Analysis</a><ul>
<li class="chapter" data-level="11.1" data-path="use-case-multi-omics-data-from-colorectal-cancer.html"><a href="use-case-multi-omics-data-from-colorectal-cancer.html"><i class="fa fa-check"></i><b>11.1</b> Use case: Multi-omics data from colorectal cancer</a></li>
<li class="chapter" data-level="11.2" data-path="latent-variable-models-for-multi-omics-integration.html"><a href="latent-variable-models-for-multi-omics-integration.html"><i class="fa fa-check"></i><b>11.2</b> Latent variable models for multi-omics integration</a></li>
<li class="chapter" data-level="11.3" data-path="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html"><a href="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html"><i class="fa fa-check"></i><b>11.3</b> Matrix factorization methods for unsupervised multi-omics data integration</a><ul>
<li class="chapter" data-level="11.3.1" data-path="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html"><a href="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html#multiple-factor-analysis"><i class="fa fa-check"></i><b>11.3.1</b> Multiple factor analysis</a></li>
<li class="chapter" data-level="11.3.2" data-path="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html"><a href="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html#joint-non-negative-matrix-factorization"><i class="fa fa-check"></i><b>11.3.2</b> Joint non-negative matrix factorization</a></li>
<li class="chapter" data-level="11.3.3" data-path="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html"><a href="matrix-factorization-methods-for-unsupervised-multi-omics-data-integration.html#icluster"><i class="fa fa-check"></i><b>11.3.3</b> iCluster</a></li>
</ul></li>
<li class="chapter" data-level="11.4" data-path="clustering-using-latent-factors.html"><a href="clustering-using-latent-factors.html"><i class="fa fa-check"></i><b>11.4</b> Clustering using latent factors</a><ul>
<li class="chapter" data-level="11.4.1" data-path="clustering-using-latent-factors.html"><a href="clustering-using-latent-factors.html#one-hot-clustering"><i class="fa fa-check"></i><b>11.4.1</b> One-hot clustering</a></li>
<li class="chapter" data-level="11.4.2" data-path="clustering-using-latent-factors.html"><a href="clustering-using-latent-factors.html#k-means-clustering-1"><i class="fa fa-check"></i><b>11.4.2</b> K-means clustering</a></li>
</ul></li>
<li class="chapter" data-level="11.5" data-path="biological-interpretation-of-latent-factors.html"><a href="biological-interpretation-of-latent-factors.html"><i class="fa fa-check"></i><b>11.5</b> Biological interpretation of latent factors</a><ul>
<li class="chapter" data-level="11.5.1" data-path="biological-interpretation-of-latent-factors.html"><a href="biological-interpretation-of-latent-factors.html#inspection-of-feature-weights-in-loading-vectors"><i class="fa fa-check"></i><b>11.5.1</b> Inspection of feature weights in loading vectors</a></li>
<li class="chapter" data-level="11.5.2" data-path="biological-interpretation-of-latent-factors.html"><a href="biological-interpretation-of-latent-factors.html#making-sense-of-factors-using-enrichment-analysis"><i class="fa fa-check"></i><b>11.5.2</b> Making sense of factors using enrichment analysis</a></li>
<li class="chapter" data-level="11.5.3" data-path="biological-interpretation-of-latent-factors.html"><a href="biological-interpretation-of-latent-factors.html#interpretation-using-additional-covariates"><i class="fa fa-check"></i><b>11.5.3</b> Interpretation using additional covariates</a></li>
</ul></li>
<li class="chapter" data-level="11.6" data-path="exercises-9.html"><a href="exercises-9.html"><i class="fa fa-check"></i><b>11.6</b> Exercises</a><ul>
<li class="chapter" data-level="11.6.1" data-path="exercises-9.html"><a href="exercises-9.html#matrix-factorization-methods"><i class="fa fa-check"></i><b>11.6.1</b> Matrix factorization methods</a></li>
<li class="chapter" data-level="11.6.2" data-path="exercises-9.html"><a href="exercises-9.html#clustering-using-latent-factors-1"><i class="fa fa-check"></i><b>11.6.2</b> Clustering using latent factors</a></li>
<li class="chapter" data-level="11.6.3" data-path="exercises-9.html"><a href="exercises-9.html#biological-interpretation-of-latent-factors-1"><i class="fa fa-check"></i><b>11.6.3</b> Biological interpretation of latent factors</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>References</a></li>
<li class="divider"></li>
<li><a href="https://bookdown.org" target="_blank">Published with bookdown</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Computational Genomics with R</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="exercises" class="section level2">
<h2><span class="header-section-number">2.10</span> Exercises</h2>
<div id="computations-in-r-1" class="section level3">
<h3><span class="header-section-number">2.10.1</span> Computations in R</h3>
<ol style="list-style-type: decimal">
<li><p>Sum 2 and 3 using the <code>+</code> operator. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Take the square root of 36, use <code>sqrt()</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Take the log10 of 1000, use function <code>log10()</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Take the log2 of 32, use function <code>log2()</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Assign the sum of 2,3 and 4 to variable x. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Find the absolute value of the expression <code>5 - 145</code> using the <code>abs()</code> function. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Calculate the square root of 625, divide it by 5, and assign it to variable <code>x</code>.Ex: <code>y= log10(1000)/5</code>, the previous statement takes log10 of 1000, divides it by 5, and assigns the value to variable y. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Multiply the value you get from previous exercise by 10000, assign it to variable x
Ex: <code>y=y*5</code>, multiplies <code>y</code> by 5 and assigns the value to <code>y</code>.
<strong>KEY CONCEPT:</strong> results of computations or arbitrary values can be stored in variables we can re-use those variables later on and over-write them with new values.
[Difficulty: <strong>Beginner</strong>]</p></li>
</ol>
</div>
<div id="data-structures-in-r" class="section level3">
<h3><span class="header-section-number">2.10.2</span> Data structures in R</h3>
<ol start="10" style="list-style-type: decimal">
<li><p>Make a vector of 1,2,3,5 and 10 using <code>c()</code>, and assign it to the <code>vec</code> variable. Ex: <code>vec1=c(1,3,4)</code> makes a vector out of 1,3,4. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Check the length of your vector with length().
Ex: <code>length(vec1)</code> should return 3. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a vector of all numbers between 2 and 15.
Ex: <code>vec=1:6</code> makes a vector of numbers between 1 and 6, and assigns it to the <code>vec</code> variable. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a vector of 4s repeated 10 times using the <code>rep()</code> function. Ex: <code>rep(x=2,times=5)</code> makes a vector of 2s repeated 5 times. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a logical vector with TRUE, FALSE values of length 4, use <code>c()</code>.
Ex: <code>c(TRUE,FALSE)</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a character vector of the gene names PAX6,ZIC2,OCT4 and SOX2.
Ex: <code>avec=c("a","b","c")</code> makes a character vector of a,b and c. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Subset the vector using <code>[]</code> notation, and get the 5th and 6th elements.
Ex: <code>vec1[1]</code> gets the first element. <code>vec1[c(1,3)]</code> gets the 1st and 3rd elements. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>You can also subset any vector using a logical vector in <code>[]</code>. Run the following:</p></li>
</ol>
<div class="sourceCode" id="cb118"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb118-1"><a href="exercises.html#cb118-1"></a>myvec=<span class="dv">1</span><span class="op">:</span><span class="dv">5</span></span>
<span id="cb118-2"><a href="exercises.html#cb118-2"></a><span class="co"># the length of the logical vector </span></span>
<span id="cb118-3"><a href="exercises.html#cb118-3"></a><span class="co"># should be equal to length(myvec) </span></span>
<span id="cb118-4"><a href="exercises.html#cb118-4"></a>myvec[<span class="kw">c</span>(<span class="ot">TRUE</span>,<span class="ot">TRUE</span>,<span class="ot">FALSE</span>,<span class="ot">FALSE</span>,<span class="ot">FALSE</span>)] </span>
<span id="cb118-5"><a href="exercises.html#cb118-5"></a>myvec[<span class="kw">c</span>(<span class="ot">TRUE</span>,<span class="ot">FALSE</span>,<span class="ot">FALSE</span>,<span class="ot">FALSE</span>,<span class="ot">TRUE</span>)]</span></code></pre></div>
<p>[Difficulty: <strong>Beginner</strong>]</p>
<ol start="18" style="list-style-type: decimal">
<li><code>==,>,<, >=, <=</code> operators create logical vectors. See the results of the following operations:</li>
</ol>
<div class="sourceCode" id="cb119"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb119-1"><a href="exercises.html#cb119-1"></a>myvec <span class="op">></span><span class="st"> </span><span class="dv">3</span></span>
<span id="cb119-2"><a href="exercises.html#cb119-2"></a>myvec <span class="op">==</span><span class="st"> </span><span class="dv">4</span></span>
<span id="cb119-3"><a href="exercises.html#cb119-3"></a>myvec <span class="op"><=</span><span class="st"> </span><span class="dv">2</span></span>
<span id="cb119-4"><a href="exercises.html#cb119-4"></a>myvec <span class="op">!=</span><span class="st"> </span><span class="dv">4</span></span></code></pre></div>
<p>[Difficulty: <strong>Beginner</strong>]</p>
<ol start="19" style="list-style-type: decimal">
<li><p>Use the <code>></code> operator in <code>myvec[ ]</code> to get elements larger than 2 in <code>myvec</code> which is described above. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a 5x3 matrix (5 rows, 3 columns) using <code>matrix()</code>.
Ex: <code>matrix(1:6,nrow=3,ncol=2)</code> makes a 3x2 matrix using numbers between 1 and 6. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>What happens when you use <code>byrow = TRUE</code> in your matrix() as an additional argument?
Ex: <code>mat=matrix(1:6,nrow=3,ncol=2,byrow = TRUE)</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the first 3 columns and first 3 rows of your matrix using <code>[]</code> notation. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the last two rows of the matrix you created earlier.
Ex: <code>mat[2:3,]</code> or <code>mat[c(2,3),]</code> extracts the 2nd and 3rd rows.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the first two columns and run <code>class()</code> on the result.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the first column and run <code>class()</code> on the result, compare with the above exercise.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a data frame with 3 columns and 5 rows. Make sure first column is a sequence
of numbers 1:5, and second column is a character vector.
Ex: <code>df=data.frame(col1=1:3,col2=c("a","b","c"),col3=3:1) # 3x3 data frame</code>.
Remember you need to make a 3x5 data frame. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the first two columns and first two rows.
<strong>HINT:</strong> Use the same notation as matrices. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the last two rows of the data frame you made.
<strong>HINT:</strong> Same notation as matrices. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the last two columns using the column names of the data frame you made. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract the second column using the column names.
You can use <code>[]</code> or <code>$</code> as in lists; use both in two different answers. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract rows where the 1st column is larger than 3.
<strong>HINT:</strong> You can get a logical vector using the <code>></code> operator
, and logical vectors can be used in <code>[]</code> when subsetting. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Extract rows where the 1st column is larger than or equal to 3.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Convert a data frame to the matrix. <strong>HINT:</strong> Use <code>as.matrix()</code>.
Observe what happens to numeric values in the data frame. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a list using the <code>list()</code> function. Your list should have 4 elements;
the one below has 2. Ex: <code>mylist= list(a=c(1,2,3),b=c("apple,"orange"))</code>
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Select the 1st element of the list you made using <code>$</code> notation.
Ex: <code>mylist$a</code> selects first element named “a”.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Select the 4th element of the list you made earlier using <code>$</code> notation. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Select the 1st element of your list using <code>[ ]</code> notation.
Ex: <code>mylist[1]</code> selects the first element named “a”, and you get a list with one element. <code>mylist["a"]</code> selects the first element named “a”, and you get a list with one element.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Select the 4th element of your list using <code>[ ]</code> notation. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a factor using factor(), with 5 elements.
Ex: <code>fa=factor(c("a","a","b"))</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Convert a character vector to a factor using <code>as.factor()</code>.
First, make a character vector using <code>c()</code> then use <code>as.factor()</code>.
[Difficulty: <strong>Intermediate</strong>]</p></li>
<li><p>Convert the factor you made above to a character using <code>as.character()</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
</ol>
</div>
<div id="reading-in-and-writing-data-out-in-r" class="section level3">
<h3><span class="header-section-number">2.10.3</span> Reading in and writing data out in R</h3>
<ol style="list-style-type: decimal">
<li>Read CpG island (CpGi) data from the compGenomRData package <code>CpGi.table.hg18.txt</code>. This is a tab-separated file. Store it in a variable called <code>cpgi</code>. Use</li>
</ol>
<pre><code>cpgFilePath=system.file("extdata",
"CpGi.table.hg18.txt",
package="compGenomRData")</code></pre>
<p>to get the file path within the installed <code>compGenomRData</code> package. [Difficulty: <strong>Beginner</strong>]</p>
<ol start="2" style="list-style-type: decimal">
<li><p>Use <code>head()</code> on CpGi to see the first few rows. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Why doesn’t the following work? See <code>sep</code> argument at <code>help(read.table)</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
</ol>
<div class="sourceCode" id="cb121"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb121-1"><a href="exercises.html#cb121-1"></a>cpgtFilePath=<span class="kw">system.file</span>(<span class="st">"extdata"</span>,</span>
<span id="cb121-2"><a href="exercises.html#cb121-2"></a> <span class="st">"CpGi.table.hg18.txt"</span>,</span>
<span id="cb121-3"><a href="exercises.html#cb121-3"></a> <span class="dt">package=</span><span class="st">"compGenomRData"</span>)</span>
<span id="cb121-4"><a href="exercises.html#cb121-4"></a>cpgtFilePath</span>
<span id="cb121-5"><a href="exercises.html#cb121-5"></a>cpgiSepComma=<span class="kw">read.table</span>(cpgtFilePath,<span class="dt">header=</span><span class="ot">TRUE</span>,<span class="dt">sep=</span><span class="st">","</span>)</span>
<span id="cb121-6"><a href="exercises.html#cb121-6"></a><span class="kw">head</span>(cpgiSepComma)</span></code></pre></div>
<ol start="4" style="list-style-type: decimal">
<li>What happens when you set <code>stringsAsFactors=FALSE</code> in <code>read.table()</code>? [Difficulty: <strong>Beginner</strong>]</li>
</ol>
<div class="sourceCode" id="cb122"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb122-1"><a href="exercises.html#cb122-1"></a>cpgiHF=<span class="kw">read.table</span>(<span class="st">"intro2R_data/data/CpGi.table.hg18.txt"</span>,</span>
<span id="cb122-2"><a href="exercises.html#cb122-2"></a> <span class="dt">header=</span><span class="ot">FALSE</span>,<span class="dt">sep=</span><span class="st">"</span><span class="ch">\t</span><span class="st">"</span>,</span>
<span id="cb122-3"><a href="exercises.html#cb122-3"></a> <span class="dt">stringsAsFactors=</span><span class="ot">FALSE</span>)</span></code></pre></div>
<ol start="5" style="list-style-type: decimal">
<li><p>Read only the first 10 rows of the CpGi table. [Difficulty: <strong>Beginner/Intermediate</strong>]</p></li>
<li><p>Use <code>cpgFilePath=system.file("extdata","CpGi.table.hg18.txt",</code>
<code>package="compGenomRData")</code> to get the file path, then use
<code>read.table()</code> with argument <code>header=FALSE</code>. Use <code>head()</code> to see the results. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Write CpG islands to a text file called “my.cpgi.file.txt”. Write the file
to your home folder; you can use <code>file="~/my.cpgi.file.txt"</code> in linux. <code>~/</code> denotes
home folder.[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Same as above but this time make sure to use the <code>quote=FALSE</code>,<code>sep="\t"</code> and <code>row.names=FALSE</code> arguments. Save the file to “my.cpgi.file2.txt” and compare it with “my.cpgi.file.txt”. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Write out the first 10 rows of the <code>cpgi</code> data frame.
<strong>HINT:</strong> Use subsetting for data frames we learned before. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Write the first 3 columns of the <code>cpgi</code> data frame. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Write CpG islands only on chr1. <strong>HINT:</strong> Use subsetting with <code>[]</code>, feed a logical vector using <code>==</code> operator.[Difficulty: <strong>Beginner/Intermediate</strong>]</p></li>
<li><p>Read two other data sets “rn4.refseq.bed” and “rn4.refseq2name.txt” with <code>header=FALSE</code>, and assign them to df1 and df2 respectively.
They are again included in the compGenomRData package, and you
can use the <code>system.file()</code> function to get the file paths. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use <code>head()</code> to see what is inside the data frames above. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Merge data sets using <code>merge()</code> and assign the results to a variable named ‘new.df’, and use <code>head()</code> to see the results. [Difficulty: <strong>Intermediate</strong>]</p></li>
</ol>
</div>
<div id="plotting-in-r" class="section level3">
<h3><span class="header-section-number">2.10.4</span> Plotting in R</h3>
<p>Please run the following code snippet for the rest of the exercises.</p>
<div class="sourceCode" id="cb123"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb123-1"><a href="exercises.html#cb123-1"></a><span class="kw">set.seed</span>(<span class="dv">1001</span>)</span>
<span id="cb123-2"><a href="exercises.html#cb123-2"></a>x1=<span class="dv">1</span><span class="op">:</span><span class="dv">100</span><span class="op">+</span><span class="kw">rnorm</span>(<span class="dv">100</span>,<span class="dt">mean=</span><span class="dv">0</span>,<span class="dt">sd=</span><span class="dv">15</span>)</span>
<span id="cb123-3"><a href="exercises.html#cb123-3"></a>y1=<span class="dv">1</span><span class="op">:</span><span class="dv">100</span></span></code></pre></div>
<ol style="list-style-type: decimal">
<li><p>Make a scatter plot using the <code>x1</code> and <code>y1</code> vectors generated above. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use the <code>main</code> argument to give a title to <code>plot()</code> as in <code>plot(x,y,main="title")</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use the <code>xlab</code> argument to set a label for the x-axis. Use <code>ylab</code> argument to set a label for the y-axis. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Once you have the plot, run the following expression in R console. <code>mtext(side=3,text="hi there")</code> does. <strong>HINT:</strong> <code>mtext</code> stands for margin text. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>See what <code>mtext(side=2,text="hi there")</code> does. Check your plot after execution. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use <em>mtext()</em> and <em>paste()</em> to put a margin text on the plot. You can use <code>paste()</code> as ‘text’ argument in <code>mtext()</code>. <strong>HINT:</strong> <code>mtext(side=3,text=paste(...))</code>. See how <code>paste()</code> is used for below. [Difficulty: <strong>Beginner/Intermediate</strong>]</p></li>
</ol>
<div class="sourceCode" id="cb124"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb124-1"><a href="exercises.html#cb124-1"></a><span class="kw">paste</span>(<span class="st">"Text"</span>,<span class="st">"here"</span>)</span></code></pre></div>
<pre><code>## [1] "Text here"</code></pre>
<div class="sourceCode" id="cb126"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb126-1"><a href="exercises.html#cb126-1"></a>myText=<span class="kw">paste</span>(<span class="st">"Text"</span>,<span class="st">"here"</span>)</span>
<span id="cb126-2"><a href="exercises.html#cb126-2"></a>myText</span></code></pre></div>
<pre><code>## [1] "Text here"</code></pre>
<ol start="7" style="list-style-type: decimal">
<li><p><code>cor()</code> calculates the correlation between two vectors.
Pearson correlation is a measure of the linear correlation (dependence)
between two variables X and Y. Try using the <code>cor()</code> function on the <code>x1</code> and <code>y1</code> variables. [Difficulty: <strong>Intermediate</strong>]</p></li>
<li><p>Try to use <code>mtext()</code>,<code>cor()</code> and <code>paste()</code> to display the correlation coefficient on your scatter plot. [Difficulty: <strong>Intermediate</strong>]</p></li>
<li><p>Change the colors of your plot using the <code>col</code> argument.
Ex: <code>plot(x,y,col="red")</code>. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use <code>pch=19</code> as an argument in your <code>plot()</code> command. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use <code>pch=18</code> as an argument to your <code>plot()</code> command. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a histogram of <code>x1</code> with the <code>hist()</code> function. A histogram is a graphical representation of the data distribution. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>You can change colors with ‘col’, add labels with ‘xlab’, ‘ylab’, and add a ‘title’ with ‘main’ arguments. Try all these in a histogram.
[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a boxplot of y1 with <code>boxplot()</code>.[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make boxplots of <code>x1</code> and <code>y1</code> vectors in the same plot.[Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>In boxplot, use the <code>horizontal = TRUE</code> argument. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make multiple plots with <code>par(mfrow=c(2,1))</code></p>
<ul>
<li>run <code>par(mfrow=c(2,1))</code></li>
<li>make a boxplot</li>
<li>make a histogram
[Difficulty: <strong>Beginner/Intermediate</strong>]</li>
</ul></li>
<li><p>Do the same as above but this time with <code>par(mfrow=c(1,2))</code>. [Difficulty: <strong>Beginner/Intermediate</strong>]</p></li>
<li><p>Save your plot using the “Export” button in Rstudio. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>You can make a scatter plot showing the density
of points rather than points themselves. If you use points it looks like this:</p></li>
</ol>
<div class="sourceCode" id="cb128"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb128-1"><a href="exercises.html#cb128-1"></a>x2=<span class="dv">1</span><span class="op">:</span><span class="dv">1000</span><span class="op">+</span><span class="kw">rnorm</span>(<span class="dv">1000</span>,<span class="dt">mean=</span><span class="dv">0</span>,<span class="dt">sd=</span><span class="dv">200</span>)</span>
<span id="cb128-2"><a href="exercises.html#cb128-2"></a>y2=<span class="dv">1</span><span class="op">:</span><span class="dv">1000</span></span>
<span id="cb128-3"><a href="exercises.html#cb128-3"></a><span class="kw">plot</span>(x2,y2,<span class="dt">pch=</span><span class="dv">19</span>,<span class="dt">col=</span><span class="st">"blue"</span>)</span></code></pre></div>
<p><img src="02-intro2R_files/figure-html/colorScatterEx-1.png" width="50%" style="display: block; margin: auto;" /></p>
<p>If you use the <code>smoothScatter()</code> function, you get the densities.</p>
<div class="sourceCode" id="cb129"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb129-1"><a href="exercises.html#cb129-1"></a><span class="kw">smoothScatter</span>(x2,y2,</span>
<span id="cb129-2"><a href="exercises.html#cb129-2"></a> <span class="dt">colramp=</span><span class="kw">colorRampPalette</span>(<span class="kw">c</span>(<span class="st">"white"</span>,<span class="st">"blue"</span>,</span>
<span id="cb129-3"><a href="exercises.html#cb129-3"></a> <span class="st">"green"</span>,<span class="st">"yellow"</span>,<span class="st">"red"</span>))) </span></code></pre></div>
<p><img src="02-intro2R_files/figure-html/smoothScatterEx-1.png" width="50%" style="display: block; margin: auto;" /></p>
<p>Now, plot with the <code>colramp=heat.colors</code> argument and then use a custom color scale using the following argument.</p>
<pre><code>colramp = colorRampPalette(c("white","blue", "green","yellow","red")))</code></pre>
<p>[Difficulty: <strong>Beginner/Intermediate</strong>]</p>
</div>
<div id="functions-and-control-structures-for-ifelse-etc.-1" class="section level3">
<h3><span class="header-section-number">2.10.5</span> Functions and control structures (for, if/else, etc.)</h3>
<p>Read CpG island data as shown below for the rest of the exercises.</p>
<div class="sourceCode" id="cb131"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb131-1"><a href="exercises.html#cb131-1"></a>cpgtFilePath=<span class="kw">system.file</span>(<span class="st">"extdata"</span>,</span>
<span id="cb131-2"><a href="exercises.html#cb131-2"></a> <span class="st">"CpGi.table.hg18.txt"</span>,</span>
<span id="cb131-3"><a href="exercises.html#cb131-3"></a> <span class="dt">package=</span><span class="st">"compGenomRData"</span>)</span>
<span id="cb131-4"><a href="exercises.html#cb131-4"></a>cpgi=<span class="kw">read.table</span>(cpgtFilePath,<span class="dt">header=</span><span class="ot">TRUE</span>,<span class="dt">sep=</span><span class="st">"</span><span class="ch">\t</span><span class="st">"</span>)</span>
<span id="cb131-5"><a href="exercises.html#cb131-5"></a><span class="kw">head</span>(cpgi)</span></code></pre></div>
<pre><code>## chrom chromStart chromEnd name length cpgNum gcNum perCpg perGc obsExp
## 1 chr1 18598 19673 CpG: 116 1075 116 787 21.6 73.2 0.83
## 2 chr1 124987 125426 CpG: 30 439 30 295 13.7 67.2 0.64
## 3 chr1 317653 318092 CpG: 29 439 29 295 13.2 67.2 0.62
## 4 chr1 427014 428027 CpG: 84 1013 84 734 16.6 72.5 0.64
## 5 chr1 439136 440407 CpG: 99 1271 99 777 15.6 61.1 0.84
## 6 chr1 523082 523977 CpG: 94 895 94 570 21.0 63.7 1.04</code></pre>
<ol style="list-style-type: decimal">
<li><p>Check values in the perGc column using a histogram.
The ‘perGc’ column in the data stands for GC percent => percentage of C+G nucleotides. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Make a boxplot for the ‘perGc’ column. [Difficulty: <strong>Beginner</strong>]</p></li>
<li><p>Use if/else structure to decide if the given GC percent is high, low or medium.
If it is low, high, or medium: low < 60, high>75, medium is between 60 and 75;
use greater or less than operators, <code><</code> or <code>></code>. Fill in the values in the code below, where it is written ‘YOU_FILL_IN’. [Difficulty: <strong>Intermediate</strong>]</p></li>
</ol>
<div class="sourceCode" id="cb133"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb133-1"><a href="exercises.html#cb133-1"></a>GCper=<span class="dv">65</span></span>
<span id="cb133-2"><a href="exercises.html#cb133-2"></a></span>
<span id="cb133-3"><a href="exercises.html#cb133-3"></a> <span class="co"># check if GC value is lower than 60, </span></span>
<span id="cb133-4"><a href="exercises.html#cb133-4"></a> <span class="co"># assign "low" to result</span></span>
<span id="cb133-5"><a href="exercises.html#cb133-5"></a> <span class="cf">if</span>(<span class="st">'YOU_FILL_IN'</span>){</span>
<span id="cb133-6"><a href="exercises.html#cb133-6"></a> result=<span class="st">"low"</span></span>
<span id="cb133-7"><a href="exercises.html#cb133-7"></a> <span class="kw">cat</span>(<span class="st">"low"</span>)</span>
<span id="cb133-8"><a href="exercises.html#cb133-8"></a> }</span>
<span id="cb133-9"><a href="exercises.html#cb133-9"></a> <span class="cf">else</span> <span class="cf">if</span>(<span class="st">'YOU_FILL_IN'</span>){ <span class="co"># check if GC value is higher than 75, </span></span>
<span id="cb133-10"><a href="exercises.html#cb133-10"></a> <span class="co">#assign "high" to result</span></span>
<span id="cb133-11"><a href="exercises.html#cb133-11"></a> result=<span class="st">"high"</span></span>
<span id="cb133-12"><a href="exercises.html#cb133-12"></a> <span class="kw">cat</span>(<span class="st">"high"</span>)</span>
<span id="cb133-13"><a href="exercises.html#cb133-13"></a> }<span class="cf">else</span>{ <span class="co"># if those two conditions fail then it must be "medium"</span></span>
<span id="cb133-14"><a href="exercises.html#cb133-14"></a> result=<span class="st">"medium"</span></span>
<span id="cb133-15"><a href="exercises.html#cb133-15"></a> }</span>
<span id="cb133-16"><a href="exercises.html#cb133-16"></a></span>
<span id="cb133-17"><a href="exercises.html#cb133-17"></a>result</span></code></pre></div>
<ol start="4" style="list-style-type: decimal">
<li>Write a function that takes a value of GC percent and decides
if it is low, high, or medium: low < 60, high>75, medium is between 60 and 75.
Fill in the values in the code below, where it is written ‘YOU_FILL_IN’. [Difficulty: <strong>Intermediate/Advanced</strong>]</li>
</ol>
<pre><code>GCclass<-function(my.gc){
YOU_FILL_IN
return(result)
}
GCclass(10) # should return "low"
GCclass(90) # should return "high"
GCclass(65) # should return "medium"</code></pre>
<ol start="5" style="list-style-type: decimal">
<li>Use a for loop to get GC percentage classes for <code>gcValues</code> below. Use the function
you wrote above.[Difficulty: <strong>Intermediate/Advanced</strong>]</li>
</ol>
<pre><code>gcValues=c(10,50,70,65,90)
for( i in YOU_FILL_IN){
YOU_FILL_IN
}</code></pre>
<ol start="6" style="list-style-type: decimal">
<li>Use <code>lapply</code> to get GC percentage classes for <code>gcValues</code>. [Difficulty: <strong>Intermediate/Advanced</strong>]</li>
</ol>
<div class="sourceCode" id="cb136"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb136-1"><a href="exercises.html#cb136-1"></a>vec=<span class="kw">c</span>(<span class="dv">1</span>,<span class="dv">2</span>,<span class="dv">4</span>,<span class="dv">5</span>)</span>
<span id="cb136-2"><a href="exercises.html#cb136-2"></a>power2=<span class="cf">function</span>(x){ <span class="kw">return</span>(x<span class="op">^</span><span class="dv">2</span>) }</span>
<span id="cb136-3"><a href="exercises.html#cb136-3"></a> <span class="kw">lapply</span>(vec,power2)</span></code></pre></div>
<ol start="7" style="list-style-type: decimal">
<li><p>Use sapply to get values to get GC percentage classes for <code>gcValues</code>. [Difficulty: <strong>Intermediate</strong>]</p></li>
<li><p>Is there a way to decide on the GC percentage class of a given vector of <code>GCpercentages</code>
without using if/else structure and loops ? if so, how can you do it?
<strong>HINT:</strong> Subsetting using < and > operators.
[Difficulty: <strong>Intermediate</strong>]</p></li>
</ol>
</div>
</div>
<!-- </div> -->
</section>
</div>
</div>
</div>
<a href="functions-and-control-structures-for-ifelse-etc-.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="stats.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": true,
"facebook": false,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/compgenomr/book/edit/master/02-intro2R.Rmd",
"text": "Edit"
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": null,
"toc": {
"collapse": "none"
}
});
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
var src = "true";
if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:")
if (/^https?:/.test(src))
src = src.replace(/^https?:/, '');
script.src = src;
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>