-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlecture1.Rmd
580 lines (420 loc) · 17.6 KB
/
lecture1.Rmd
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
---
title: "BCB420 - Computational Systems Biology"
subtitle: "Course Introduction"
author: "Ruth Isserlin"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```
class: center, middle
![](https://bcb.csb.utoronto.ca/files/2019/05/cropped-Header_artwork_new_WP_site_May2019-1.jpg)
Welcome to BCB420 Spring 2020 - <br>
Computational System Biology
<br><br>
Instructor : Ruth Isserlin
<br><br>
TA : Owen Whitley
???
---
# Course Overview
* Brief Introduction<br>
* Course aims<br>
* Marking breakdown<br>
* Where to find all information pertaining to the course<br>
* Quiz - January 21,2020 (Mock Quiz - January 14)<br>
* Wiki and Journal<br>
* Assignment #1 - Due February 4, 2020<br>
* Docker<br>
---
class: center
# Introduction
I am a Bioinformatician in [Gary Bader's lab]() <br><br>
--
I have been at <img src="https://cdn.freebiesupply.com/logos/large/2x/university-of-toronto-logo-png-transparent.png" width="5%" /> for over 20 years<br><br>
--
I have been working in the field of bioinformatics for almost the same amount of time. <br><br>
--
I have worked with varying types of data including protein-protein interaction data, genomics, proteomics, metabolomics, methylation .... ,<br><br>
--
I have worked with many different programming languages including c, Perl, java, python,matlab, R, good old bash...<br><br>
--
What I have learned over all my years in bioinformatics is:<br><br>
--
The data **will** change, <br>
--
the methods **will** evolve and require **increasing amounts of resources**,<br>
--
but it will always come down to mapping identifiers :)
---
# Course Aims
What is Computational Systems Biology?<br><br>
--
According to the U of T course description: <br><br>
.center["Current approaches to using the computer for analyzing and modeling biology as integrated molecular systems."]<br><br>
--
According to [Nature](https://www.nature.com/)'s 2002 article [Computational Systems Biology](Kitano, H. Computational systems biology. Nature 420, 206–210 (2002) doi:10.1038/nature01254) is:<br><br>
.center["To understand complex biological systems requires the integration of experimental and computational research — in other words a systems biology approach. Computational biology, through pragmatic modelling and theoretical exploration, provides a powerful foundation from which to address critical scientific questions head-on."]<br>
---
class: left
# Course Aims
So, what are **we** going to be covering during this course?<br>
![](./images/course_overview_flowchart.png)
* Everyone is going to find and claim an unique -omics expression dataset.
* We will then normalize and clean the dataset
* We will then perform differential expression analysis on the dataset.
* We will the conduct pathway and network analysis on the dataset in order to visualize and interpret it.
---
class: left
#Marking Breakdown
| Item | Weight | Due Date |
| --- | --- | --- |
| initial set up | 5 marks | January 10, 2020 |
| Quiz on preparatory material | 20 marks | January 21, 2020 |
| Assignment 1 | 20 marks | February 4, 2020 |
| Assignment 2 | 20 marks | March 3, 2020 |
| Assignment 3 | 20 marks | March 24, 2020 |
| Journal/Insights | 15 marks | On going. |
| Total | 100 marks | - |
---
class: center
background-image: url(./images/course_setup.png)
background-size: contain
# Course Set up
---
class: left
# Course Set up - cont'd
The initial course set up is outlined [here](https://github.com/bcb420-2020/General_Course_Info/wiki#Initial_set_up) and will count for 5 marks of your grade. It is due **Friday January 10,2020 by 5:00 PM**
## Step 1
In order to get started you need to get added to the [bcb420-2020 organization](https://github.com/bcb420-2020).<br>
Enter an issue:<br><li>https://github.com/bcb420-2020/Student_Wiki/issues</li> - containing your github username that needs to be added to the organization<br>.
---
#Course Set up - cont'd
## Step 2
Everyone in the course will have a repository in the [bcb420-2020 organization](https://github.com/bcb420-2020) that belongs to them. This repo is where you will submit all your assignments and maintain your own journal as a wiki associated with the repo.<br>
Once your repo has been set up you need to:<br>
1. Start your course journal - there is a sample student repo with a sample journal posting that can be found [here](https://github.com/bcb420-2020/ExampleStudent/wiki).
1. Start going through the preparatory material - start [here](https://bcb420-2020.github.io/General_course_prep/)
1. Follow the remaining steps outlined in the [initial assignment](https://github.com/bcb420-2020/General_Course_Info/wiki#Initial_set_up)
---
# Course Set up - cont'd
## Step 3
* Look through the information on the main course page - [Main course website](https://github.com/bcb420-2020/General_Course_Info/wiki)
* Make sure you add the links to your journal to the [Main Student wiki](https://github.com/bcb420-2020/Student_Wiki/wiki)
---
class: center
# Course discussions
<font size=10>Which platform do you prefer to have class discussions in?</font> <br><br>
<font size=10>Google groups or Quercus </font> <br><br>
<font size=10>fill in the survey here - https://forms.gle/QAfcA56EbgiFx4Hs9 </font> <br><br>
---
class: left
# Quiz
<font size=12> The quiz is worth 20 marks</font>
The purpose of the quiz is to make sure we are all starting on the same page. You are expected to already be familiar with R so this should just be a refresher. <br><br>
All the [preparatory material](https://github.com/bcb420-2020/General_Course_Info/wiki#Preparatory_Materials_and_Prerequisites) will be on the quiz.<br><br>
Going through all the tasks in https://bcb420-2020.github.io/R_basics/ is good preparation for the quiz. <br><br>
We will have a mock quiz next week, **January 14, 2020 during class**. We will then review and discuss the quiz after it is complete so everyone knows what to expect for the real quiz on **January 21, 2020 during class**
---
class: left
# Wiki
* In past iterations of this course the wiki used was hosted on [Prof. Steipe's personal wiki](http://steipe.biochemistry.utoronto.ca/abc/index.php/Computational_Systems_Biology_Main_Page). **Please feel free to look at the material that is there. There isa lot of great background and refresher information there.**
* We will be using github wikis for this course. **They do not have the same rich feature set that is available in mediawiki**
* Every student will maintain their own wiki in their own repository but you can also add links and content to the main [Student wiki](https://github.com/bcb420-2020/Student_Wiki/wiki) and are encouraged to do so.
* There is a section in the preparatory material that discusses [Wiki](https://bcb420-2020.github.io/General_course_prep/wiki.html). It is geared to MediaWiki. You can set github wiki to recognize the MediaWiki format but it might not recognize all features (for example, templates. I placed the copyright information as a footer of my wiki instead. )
---
class: left
# Journal
* **Main purpose** : to develop good habits.
* Things to remember:
* Often the person we are writing notes for is our future selves when we revisit a project, need to write up all the details of a given project for publication.
* data transformations, parameters, code version are good details to include.
* Errors that you encountered and how you fixed them! **They will come up again. I guarentee it!**
* **Course Journal**:
* Put your journal in the wiki of your course repo.
* Make each entry its own page in the wiki.
* Give the page a meaningful name
* On the main page of your wiki link to all your added journal pages. Feel free to organise them as you see fit but remember we will be looking through these notes so don't just put journal entry 1, journal entry 2....
* See [journal course prepratory material](https://bcb420-2020.github.io/General_course_prep/journal.html) for more details and template of a journal entry.
---
class: left
# Assignment #1
* **Due February 4,2020 **
* Outline on the course wiki [here](https://github.com/bcb420-2020/General_Course_Info/wiki/Assignment%231)<br><br>
* **Overview** :
* <font size=12>Choose a dataset,</font>
* <font size=12>get to know it,</font>
* <font size=12>claim it, and </font>
* <font size=12>clean it</font> <br><br>
* We will be going over an example dataset in week 2 and week 3 of class as well.
---
class: left
# Example Scenario (based on true events)
* Imagine this situation -
* You are processing some expression dataset and you are 95% complete
--
* In a seminar you recently attended you saw a new way to visualize the same data that you are using that looked amazing!
--
* And who doesn't love a pretty visual representation.
--
* You want to add a new plot to your current pipeline.<br>
--
* When you go to install **package_new** unfortunately it says that you need a newer version of R...<br>
--
* But you really want to add this new plot! **Should you update R in order to install this new package?**<br>
--
.center[<img src="https://media.giphy.com/media/RrVzUOXldFe8M/giphy.gif" width="25%" />]
---
class: left
# Example Scenario - cont'd
* You install a newer version of R.<br>
--
.center[<img src="https://media.giphy.com/media/pa37AAGzKXoek/giphy.gif" width="25%" />]
--
* You run your current pipeline again.<br>
--
* Sorry can't find package12 or package21 ....<br>
--
.center[<img src="https://media.giphy.com/media/tJeGZumxDB01q/giphy.gif" width="25%" />]
---
class: left
# Example Scenario - cont'd
* You notice that you never added the install statements to your script for those 2 packages that you added a few months back that helps with process x of your pipeline.
--
* You add the install statements now.
--
* **See it was good that I updated R. Caught some bugs**
.center[<img src="https://media.giphy.com/media/rIq6ASPIqo2k0/giphy.gif" width="25%" />]
---
class: left
# Example Scenario - cont'd
* You re-run your pipeline with your added **package-new** and your new beautiful cutting edge plot and everything runs smoothly.
--
.center[<img src="https://media.giphy.com/media/pa37AAGzKXoek/giphy.gif" width="25%" />]
--
* You go through your original results but something doesn't look right!
--
* **Those weren't your results!**
--
.center[<img src="https://media.giphy.com/media/11tTNkNy1SdXGg/giphy.gif" width="50%" />]
---
class: left
# What happened
What could have happened here? **Ideas**?<br>
--
* you installed the latest package-y but were previously using version 1.2.
* from version 1.2 to 1.3 they made a change to algorithm x that changed your results slightly.<br>
--
Truthfully lots could have happened. Especially when you are using multiple packages and multiple parts of your analysis.
---
class: left
# How could we have done this differently?
* Any ideas?
---
class: center, middle
<img src="https://www.docker.com/sites/default/files/d8/styles/role_icon/public/2019-07/vertical-logo-monochromatic.png?itok=erja9lKc" />
---
class: left
#Docker
* What is Docker?<br>
--
* [Docker](https://www.docker.com/) is a container platform similiar to the virtual machine but better. <br>
--
* Why is Docker **great** for Bioinformatics?<br>
* allows you to create environments to run bioinformatis pipelines.<br>
--
* create a consist environment to use for your pipelines. <br>
--
* test modifications to the pipeline without disrupting your current set up.<br>
---
class: left, middle
.pull-left[
![](./images/docker_standalone.png)
]
--
.pull-right[
* Expensive
* Moving App to new system requires build a whole new server
* Potential wasted resources
* When you out grow the system is difficult to add resources.
]
.footnote[
*slide based [Introduction to docker - 2017](https://www.slideshare.net/Docker/introduction-to-docker-2017) slideshare (slide 16-26)
]
---
class: left, middle
.pull-left[
![](./images/docker_vm.png)
]
--
.pull-right[
**Pros**<br>
* Better resource usage
* easier to scale
* encapsulation of app/website<br>
<br>
**Cons**<br>
* Each VM still needs to be allocated CPUs, RAM, storage, operating system
* The more VMs you have the more resources you need.
* Portability not guarenteed but definitely easier than the old school individual server model
]
.footnote[
*slide based [Introduction to docker - 2017](https://www.slideshare.net/Docker/introduction-to-docker-2017) slideshare (slide 16-26)
]
---
class: left, middle
.pull-left[
![](https://docs.docker.com/images/VM%402x.png)
]
.pull-right[
![](https://docs.docker.com/images/Container%402x.png)
]
A VM encapsulates a server whereas a Container encapsulates an application or service.
.footnote[
* from the docker [getting started guide](https://docs.docker.com/get-started/)
]
---
# Crash course on docker
Where to start:
* Docker - [getting started guide](https://docker-curriculum.com/)
* [Docker hub](https://hub.docker.com/) - repository of docker images
Instances we will be using:
* Rocker - a docker instance configured to run R and Rstudio and various other flavours. There are different base packages that contain different sets of R packages as default
* [main rocker page](https://www.rocker-project.org/)
* [rocker github repo](https://github.com/rocker-org/rocker)
* [rocker on docker hub](https://www.rocker-project.org/)
* Bioc - a docker instance configured to run R and contain different sets of commonly used Bioconductor packages.
* [Main bioc docker page](https://www.bioconductor.org/help/docker/)
* [bioconductor github repo](https://github.com/Bioconductor/bioc_docker) - there is some good starter notes here as well on how to set up your bioc container.
* [bioconductor on docker hub](https://hub.docker.com/u/bioconductor/)
---
class: left
# Docker Basics
## Container
* An instance of an image.
* There can be multiple containers derived from the same image.
* if you need to update it simply rebuild the image and relaunch a new container.
--
## Image
* An image is basically the container blueprint. It contains everything the container needs to run.
---
class: left
# Docker Basics - cont'd
## Dockerfile
* A description of everything that is needed for the image
* A set of commands to create the image
* Contains commands:
* FROM - which operatiing system to start from. What is your base.
* RUN - execute a given command
* COPY - copy local files into the new container
* CMD - to specify default parameters for the container
* ENTRYPOINT - specify scripts to be run at image creation
---
class: left
# Example Dockerfile
```{r eval=FALSE}
FROM bioconductor/release_core2:R3.6.0_Bioc3.9 #<<
# Install required packages
RUN install2.r \
-d TRUE -e \
-r "https://cran.rstudio.com" \
-r "http://www.bioconductor.org/packages/release/bioc" \
TCGAbiolinks \
RTCGAToolbox
#install additional packages
RUN install2.r \
-d TRUE \
-r "https://cran.rstudio.com" \
-r "http://www.bioconductor.org/packages/release/bioc" \
RColorBrewer@1.1-2 \
GEOquery@2.52.0 \
BiocGenerics@0.30.0
```
--
* Define the operating system or the base to build upon.
---
class: left
# Example Dockerfile - cont'd
```{r eval=FALSE}
FROM bioconductor/release_core2:R3.6.0_Bioc3.9
# Install required packages #<<
RUN install2.r \#<<
-d TRUE -e \#<<
-r "https://cran.rstudio.com" \#<<
-r "http://www.bioconductor.org/packages/release/bioc" \#<<
TCGAbiolinks \#<<
RTCGAToolbox #<<
#install additional packages
RUN install2.r \
-d TRUE \
-r "https://cran.rstudio.com" \
-r "http://www.bioconductor.org/packages/release/bioc" \
RColorBrewer@1.1-2 \
GEOquery@2.52.0 \
BiocGenerics@0.30.0
```
--
* Install latest versions of a given pakage.
---
# Example Dockerfile - cont'd
```{r eval=FALSE}
FROM bioconductor/release_core2:R3.6.0_Bioc3.9
# Install required packages
RUN install2.r \
-d TRUE -e \
-r "https://cran.rstudio.com" \
-r "http://www.bioconductor.org/packages/release/bioc" \
TCGAbiolinks \
RTCGAToolbox
#install additional packages
RUN install2.r \ #<<
-d TRUE \ #<<
-r "https://cran.rstudio.com" \ #<<
-r "http://www.bioconductor.org/packages/release/bioc" \ #<<
RColorBrewer@1.1-2 \ #<<
GEOquery@2.52.0 \ #<<
BiocGenerics@0.30.0 #<<
```
--
* Install specific version of a package.
---
class: left
# Docker Basics - Cont'd
## Volumes
* Files written to a directory on the container will not remain on the container once it has been stopped.
* But keeping files between runs and sharing information between containers is very useful.
* volumes offer a mechanisms to store results from a container. Mapping a drive from the host machine to a drive on the container. Files written to the mapped drive on the container will persist on the host machine.
* Volumes are defined at runtime when the container is initially created.
--
```{r eval = FALSE}
docker run -e PASSWORD=bcb420_pass
-p 8787:8787
-v "$(pwd)"/bcb420_course_work:/home/rstudio/projects #<<
bcb420_image_base
```
---
class: left
## Port forwarding
* By default the container is self contained, with no communication with the host or any other containers.
* In order to open communication you can map a port in the container to the host.
--
```{r eval = FALSE}
docker run -e PASSWORD=bcb420_pass
-p 8787:8787 #<<
-v "$(pwd)"/bcb420_course_work:/home/rstudio/projects
bcb420_image_base
```
--
* To access the container:
* Open a browser and go to localhost:8787
---
class: left
# Conclusions
* If we return to our starting example. How would docker have helped the situation?