-
Notifications
You must be signed in to change notification settings - Fork 7
/
01-gestalt.html
646 lines (614 loc) · 31.2 KB
/
01-gestalt.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Introduction to Bioinformatics</title>
<meta name="description" content="Introduction to Bioinformatics">
<!-- Disabled for now - embeds HTML in author string -->
<!-- <meta name="author" content="Lesson 1 - Gestalt & remote access" /> -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="src/theme/csmall.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="reveal.js/css/print/' +
( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) +
'.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
<!-- Note escaped dollars -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Introduction to Bioinformatics</h1>
<h3>Lesson 1 - Gestalt & remote access</h3>
<p>
<h4></h4>
</p>
</section>
<section id="first-things-first" class="level1">
<h1>First things first</h1>
<p>Did everyone successfully ssh into <code>rhino</code>?</p>
<p>Did everyone get the book?</p>
</section>
<section id="introductions" class="level1">
<h1>Introductions</h1>
<ul>
<li>Name</li>
<li>What you’re working on</li>
<li>Technical Experience</li>
</ul>
</section>
<section id="our-goals-for-this-course" class="level1">
<h1>Our goals for this course</h1>
<ul>
<li>High level overview of how to <em>approach</em> bioinformatics</li>
<li>Basic bioinformatics technical and problem solving skills</li>
<li>Enough momentum to initiate self-learning process</li>
</ul>
</section>
<section id="what-you-wont-get-from-this-course" class="level1">
<h1>What you won’t get from this course</h1>
<p>…that might be useful.</p>
<ul>
<li>Higher level programming</li>
<li>Statistics</li>
<li>Other mathematics</li>
<li>Knowledge of every bioinformatics program/method ever created</li>
</ul>
<p>Our goal is to give you enough momentum to learn what you need as you go.</p>
</section>
<section id="please-spend-time-outside-class" class="level1">
<h1>Please spend time outside class</h1>
<p>This stuff doesn’t stick unless you keep doing it.</p>
<ul>
<li>Have fun!</li>
<li>Start a project</li>
<li>Set up routine time to play</li>
<li>More time per week is great, but consistently doing <em>something</em> every week better</li>
<li>Plan to continue after the course</li>
<li>Feel free to email Brian - he gets paid for this</li>
</ul>
</section>
<section id="what-is-bioinformatics" class="level1">
<h1>What is bioinformatics?</h1>
</section>
<section id="what-is-bioinformatics-1" class="level1">
<h1>What is bioinformatics?</h1>
<p>The application of computation towards the analysis and processing of biological data</p>
</section>
<section id="in-practice-this-entails" class="level1">
<h1>In practice this entails</h1>
<ul>
<li><strong>data munging</strong>: cleaning & reshaping data</li>
<li><strong>data exploration</strong>: vizualization, intuition building, hypothesizing</li>
<li><strong>drawing conclusions</strong>: statistical analyses, publication</li>
</ul>
<p>Rinse and repeat… New insights and conclusions lead to new data and questions, etc.</p>
</section>
<section id="so-this-is-what-we-do" class="level1">
<h1>So this is <em>what</em> we do</h1>
<p><br/></p>
<section id="but-how-should-we-do-it" class="level2">
<h2>But <em>how</em> should we do it?</h2>
</section>
</section>
<section id="specific-goals-for-research" class="level1">
<h1>Specific goals for research</h1>
<ul>
<li>Reproducibility</li>
<li>Robustness</li>
<li>Accuracy</li>
<li>Clarity</li>
<li>Iterability</li>
</ul>
</section>
<section id="things-we-can-do-towards-these-goals" class="level1">
<h1>Things we can do towards these goals</h1>
<ul>
<li><strong>Immutable data</strong>: <em>never</em> change data in place; data in data out (reproducibility, iterability, clarity)</li>
<li><strong>Consistency</strong>: naming conventions, data & project layout, etc; (automation, clarity)</li>
<li><strong>Documentation</strong>: keep a digital “lab notebook”; software version, data origins, run settings, explain choices/decisions; (reproducibility, clarify)</li>
<li><strong>Automation</strong>: the best documentation; write <em>scripts</em> for everything; (reproducibility, iterability)</li>
</ul>
</section>
<section id="polyas-how-to-solve-it" class="level1">
<h1>Polya’s How to Solve It</h1>
<p>You will spend more time sitting around and thinking about how to solve problems than you will typing code.</p>
<p><a href="https://en.wikipedia.org/wiki/How_to_Solve_It" class="uri">https://en.wikipedia.org/wiki/How_to_Solve_It</a></p>
<ol type="1">
<li>Understand</li>
<li>Plan</li>
<li>Exectue</li>
<li>Reflect</li>
</ol>
<p>When this fails, try to break down into simpler pieces and iterate (solve an easier or related problem first).</p>
</section>
<section id="understanding" class="level1">
<h1>Understanding</h1>
<p>The most important, but hardest part.</p>
<ul>
<li>Write out the problem</li>
<li>Isolate what makes the problem hard</li>
<li>Draw/sketch, talk (even out loud to yourself), go for a walk, look for patterns</li>
<li>List knows, work backwards, eliminate possibilities, run examples</li>
<li>When you truly understood a problem, the solution should appear obvious, so don’t stop trying to understand until it is</li>
</ul>
</section>
<section id="questions" class="level1">
<h1>Questions?</h1>
</section>
<section id="unix" class="level1">
<h1>Unix</h1>
</section>
<section id="what-is-unix" class="level1">
<h1>What is “Unix”?</h1>
<p>Unix is a proprietary operating system from the 60s.</p>
<p>True Unix is rare these days, but its philosophy and design live on in “Unix-like” systems (including OsX). When we say “Unix”, we usually mean it in this general sense.</p>
<p>We’ll be using Ubuntu Linux, a Unix-like operating system.</p>
</section>
<section id="the-unix-philosophy" class="level1">
<h1>The Unix Philosophy</h1>
<ul>
<li>Small, <strong>composable</strong> tools that do one thing right</li>
<li>Plumb tools together into pipelines & scripts</li>
<li>Embrace plain-text data</li>
</ul>
<p>Bioinformatics naturally embraces this.</p>
</section>
<section id="the-unix-shell" class="level1">
<h1>The Unix shell</h1>
<p>The <em>shell</em> is a wrapper around the operating system, through which text commands and output are used to interact with the computer.</p>
<p>This is analogous to the desktop environment on your personal computer.</p>
</section>
<section id="remote-servers" class="level1">
<h1>Remote servers</h1>
<p>Unix was built for remote access. Computers were big and expensive, so people shared resources.</p>
<p>Today, this remains useful:</p>
<ul>
<li>The Hutch servers are really powerful</li>
<li>You can leave long running computations without worrying about unexpected shutdowns</li>
<li>Access running programs and data from any computer</li>
<li>Distribute tasks across compute clusters, such as the Hutch’s <a href="http://www.fredhutch.io/events/2015/05/20/spring-2015-unix-hpc/">gizmo clusters</a></li>
</ul>
</section>
<section id="questions-1" class="level1">
<h1>Questions?</h1>
</section>
<section id="practicum" class="level1">
<h1>Practicum!</h1>
<ul>
<li>Connect to a remote server</li>
<li>Survival guide</li>
<li>Set up a project directory and load it with data</li>
<li>Investigate our data</li>
<li>Learn how to edit files using an in-shell text editor (vi)</li>
<li>Tmux for session management</li>
</ul>
</section>
<section id="ssh-for-remote-connection" class="level1">
<h1>SSH for remote connection</h1>
<p>Do this however you figured out how to do it for your OS.</p>
<pre><code>ssh <username>@rhino</code></pre>
<p>Write down which rhino you connect to, so you can directly connect to that next time. (e.g If you get connected to <code>rhino3</code>, next time use <code>ssh <username>@rhino3</code>.)</p>
<p>Let us know if you get an error message along the lines of “<code>can't find home</code>”.</p>
</section>
<section id="from-outside-the-hutch" class="level1">
<h1>From outside the Hutch</h1>
<p>You should be able to connect to the rhinos from outside the hutch by connecting to the Hutch VPN.</p>
<p>You can also ssh into <code><username>@snail.fhcrc.org</code>, and then from there execute <code>ssh <username>@rhino<N></code> to get into your rhino.</p>
</section>
<section id="youre-now-in-a-unix-shell" class="level1">
<h1>You’re now in a Unix shell!</h1>
<p>We’ll cover things more thoroughly next class. For now, just some basic information for orientation.</p>
<p>What follows is your Zombie Apocalypse Unix guide.</p>
</section>
<section id="brief-overview-of-a-unix-command" class="level1">
<h1>Brief overview of a Unix command</h1>
<p><code>command [flags] [operands]</code></p>
<pre><code>ls -a ~</code></pre>
<ul>
<li><code>ls</code>: The command, in this case for listing directory contents</li>
<li><code>-a</code>: A flag which specifies that hidden files should be listed</li>
<li><code>~</code>: An operand, in this case a special symbol which points to your home directory</li>
</ul>
<p>Note: Spaces are important here (but not how many).</p>
</section>
<section id="getting-help-within-unix" class="level1">
<h1>Getting help within Unix</h1>
<ul>
<li>Most Unix programs will take either a <code>-h</code>, <code>--help</code>, or <code>-help</code> flag and return useful information about how to construct a valid command.</li>
<li>Some commands also have <em>man pages</em>, which you can access using <code>man <command-name></code>.</li>
<li>You can also search for programs using <code>apropos</code></li>
</ul>
<p>Example: <code>ls --help</code> & <code>man ls</code> & <code>apropos calculator</code></p>
</section>
<section id="stuck-in-a-terminal" class="level1">
<h1>Stuck in a terminal?</h1>
<p>If you are in the terminal and things seem “stuck” (a program is running that won’t stop), try the following:</p>
<p><code>Ctrl-c</code>, <code>Esc</code>, <code>q</code>, <code>Ctrl-d</code>, <code>Esc : q Enter</code></p>
<p>Note: These are <em>key commands</em>;</p>
<ul>
<li><code>-</code> means press the keys at the same time.</li>
<li>` ` (space between) means let go and press the next key</li>
</ul>
</section>
<section id="autocomplete" class="level1">
<h1>Autocomplete</h1>
<p>Bash can “auto-complete” command and filenames. Just start typing and hit <code>Tab</code>.</p>
<p>Try <code>ls ~/bioi<Tab></code>.</p>
</section>
<section id="history" class="level1">
<h1>History</h1>
<p>Bash maintains a history of the last several commands you executed. You can access these by typing <code>history</code>.</p>
<p>If you want to run a command similar to one you just executed, you can use the up/down arrow keys to move through the history, edit the line, and re-execute.</p>
</section>
<section id="questions-2" class="level1">
<h1>Questions?</h1>
</section>
<section id="supercharging-our-shell" class="level1">
<h1>Supercharging our shell</h1>
<p>SciComp has set up a <em>module</em> system for customizing your environment.</p>
<p>We’ll be using the <code>intro-bio</code> module, loaded by executing <code>module load intro-bio</code> (note: this <em>only affects the current shell session!</em>).</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">module</span> load intro-bio</code></pre></div>
<p>You might get a message that says <code>Using already loaded python</code>, but don’t worry about it. If you see nothing, it’s fine. If you see an error message, please raise your hand.</p>
</section>
<section id="customizing-our-environment" class="level1">
<h1>Customizing our environment</h1>
<p>We don’t want to have to remember to load this module every time, and there are other things we want to have set up for us every time we open a shell session. We can make these cusomtizations by editing our <code>~/.bashrc</code> configuration file.</p>
<p>But first, we’re going to learn how to edit a text file from the terminal using <code>vi</code>.</p>
</section>
<section id="introducing-vi-and-vim" class="level1">
<h1>Introducing vi and vim</h1>
<p>Vi is a wonderful, powerful, but completely arcane editor. However, it’s worth being able to use because:</p>
<ul>
<li>even the sparsest linux install will have some variant of vi.</li>
<li>when working with remote machines, it’s nice to be able to edit text in a powerful editor directly on the machine.</li>
<li>finally, sometimes another program (e.g. git) will plop you into vim without you realizing it, so it’s nice to know what to do in this situation.</li>
</ul>
</section>
<section id="vim-is-a-modal-text-editor" class="level1">
<h1>Vim is a <em>modal</em> text editor</h1>
<p>Vim has two primary modes:</p>
<ul>
<li>insert mode: typing will now insert text into the file</li>
<li>command mode: key strokes become poweful <em>commands</em>, and can carry out high-level editing tasks</li>
</ul>
<p>Fully understanding comamnd mode takes time, but basic usage is quite simple.</p>
</section>
<section id="vim-tutorial" class="level1">
<h1>Vim tutorial</h1>
<section id="create-a-file-called-vimtest.txt-with-vim" class="level2">
<h2>Create a file called <code>vimtest.txt</code> with vim</h2>
<ul>
<li>Invoke with <code>vim vimtest.txt</code></li>
<li>Type <code>i</code> to enter <em>insert mode</em></li>
<li>Type to enter text, move around with arrow keys, edit as needed</li>
<li>Hit <code>Esc</code> to exit insert mode and enter <em>command mode</em></li>
<li>Type <code>: w <Enter></code> to save</li>
<li>When you are done editing, type <code>: q <Enter></code></li>
</ul>
<p>Run <code>cat vimtest.txt</code> to see your text. That wasn’t so bad, was it?</p>
<p>(click down for more advanced usage)</p>
</section>
<section id="using-the-command-mode" class="level2">
<h2>Using the command mode</h2>
<p>So far the only real action has been in insert mode. The other mode in vi is the <em>command mode</em>. In this mode you can quickly navigate and modify your file using key commands.</p>
</section>
<section id="moving-around-quickly" class="level2">
<h2>Moving around quickly</h2>
<p>There are lots of ways to move your cursor around in command mode:</p>
<ul>
<li>The arrow keys (and the “<em>home row</em>” <code>hjkl</code> keys)</li>
<li><code>0</code> moves to the beginning of the <em>line</em>, and <code>$</code> moves to the end</li>
<li><code>b</code> moves back one <em>word</em>, and <code>w</code> moves forward one</li>
<li><code>{</code> moves back one <em>paragraph</em>, and <code>}</code> moves forward one</li>
<li><code>(</code> moves back one <em>sentence</em>, and <code>)</code> moves forward one</li>
</ul>
<p>You can prefix these commands with numbers to move faster, e.g. <code>3 w</code> moves you forward three words.</p>
</section>
<section id="cutting-and-pasting" class="level2">
<h2>Cutting and pasting</h2>
<p>There is a simple way to cut and paste exactly analogous to a word processor: highlight a block of text, then copy or cut, then paste.</p>
<ul>
<li>In command mode, move cursor to where you want to start your highlight</li>
<li>Press <code>v</code>; this places you in <em>visual</em> mode</li>
<li>Move cursor to the end of your highlighted region</li>
<li>Press <code>d</code> to cut, <code>y</code> (for <em>yank</em>) to copy</li>
<li>Move cursor to where you want to paste</li>
<li>Press <code>p</code> to paste</li>
</ul>
</section>
<section id="combining-motions-and-actions" class="level2">
<h2>Combining motions and actions</h2>
<p>Motions and actions can be combined. E.g.:</p>
<ul>
<li><code>d w</code> cuts one word, and <code>d 2 w</code> cuts two words</li>
<li><code>y w</code> copies one word, and <code>y 2 w</code> copies two words</li>
</ul>
<p>You can also cut/copy entire lines with the shortcuts <code>d d</code> and <code>y y</code>.</p>
</section>
<section id="undoredo" class="level2">
<h2>Undo/redo</h2>
<p>If you ever mess anything up (which is easy to do in command mode), <code>u</code> is undo and <code>Ctrl-r</code> is redo (from command mode).</p>
</section>
<section id="vim-resources" class="level2">
<h2>Vim resources</h2>
<ul>
<li>The <code>vimtutor</code> command, available wherever you find <code>vim</code></li>
<li><a href="http://bencrowder.net/files/vim-fu/">Ben Crowder’s vim tips</a></li>
<li><a href="https://rumorscity.com/wp-content/uploads/2014/08/10-Best-VIM-Cheat-Sheet-02.jpg">Cheatsheet/poster</a></li>
<li><a href="https://github.com/LevelbossMike/vim_shortcut_wallpaper">Wallpaper</a></li>
<li><a href="http://www.openvim.com/">An online vim tutorial</a></li>
</ul>
<p>Note that you can totally use the arrow keys while you You certainly can, though it’s not considered hip (because vim is all about efficiency, and moving your hands from home position to the arrow keys is not efficient.)</p>
</section>
</section>
<section id="customizing-our-shell" class="level1">
<h1>Customizing our shell</h1>
<p>We can customize our environment using a “dotfile” that gets loaded when new shell sessions are created: <code>~/.bashrc</code>.</p>
<ul>
<li>Run <code>vim ~/.bashrc</code> to open the file</li>
<li>Hit <code>i</code> for insert mode</li>
<li>Use arrow keys to scroll to the bottom of the file, then add:</li>
</ul>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">module</span> load intro-bio
<span class="bu">export</span> <span class="va">PATH=</span>~/bin/:<span class="va">$PATH</span></code></pre></div>
<p>Save and quit (<code>Esc</code> then <code>:wq<Enter></code>), then run <code>source ~/.bashrc</code> to reload the changes.</p>
</section>
<section id="tmux---terminal-multiplexer" class="level1">
<h1>Tmux - Terminal multiplexer</h1>
<p>Tmux let’s combine multiple Unix shells into one.</p>
<p>We could open multiple terminal windows to multitask, but each would need its own ssh connection. Also, without tmux, if our connection dies, so do our programs. With tmux we can:</p>
<ul>
<li>Put down and pick up work from multiple machines</li>
<li>Keep working on other things while a long running computation runs</li>
<li>Switch back and forth quickly between multiple projects</li>
</ul>
</section>
<section id="setting-up-tmux" class="level1">
<h1>Setting up tmux</h1>
<p>We’ll use tmux throughout this class to keep sessions running. But first let’s download a nice tmux configuration file for making things easier.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="co"># This is a command that downloads a tmux configuration file</span>
<span class="fu">wget</span> https://raw.githubusercontent.com/fredhutchio/intro-bioinformatics/gh-pages/config/tmux.conf
<span class="fu">ls</span>
<span class="co"># tmux knows to look for our config file at ~/.tmux.conf</span>
<span class="fu">mv</span> tmux.conf ~/.tmux.conf
<span class="co"># Note that this file is hidden once we make it a "dotfile"</span>
<span class="fu">ls</span> ~
<span class="fu">ls</span> -a ~</code></pre></div>
</section>
<section id="starting-a-new-tmux-session" class="level1">
<h1>Starting a new tmux session</h1>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">tmux</span></code></pre></div>
<p>You should now see a fresh shell session inside of tmux.</p>
</section>
<section id="tmux-cheatsheettutorial" class="level1">
<h1>Tmux cheatsheet/tutorial</h1>
<section id="bare-bones-tmux" class="level2">
<h2>Bare bones tmux</h2>
<ul>
<li><code>Ctrl-a</code> - your “Command key”</li>
<li><code>Ctrl-a c</code> - New window</li>
<li><code>Ctrl-a <Space></code> - Next window</li>
<li><code>Ctrl-a |</code> - Split window into panes vertically</li>
<li><code>Ctrl-a -</code> - Split window into panes horizontally</li>
<li><code>Ctrl-a <arrow></code> - Move between</li>
<li><code>Ctrl-d</code> - Close a pane or window</li>
</ul>
<p>For more tmux tips, click down.</p>
</section>
<section id="moving-between-panes-and-moving-panes" class="level2">
<h2>Moving between panes and moving panes</h2>
<p>You can also use <code>h</code>, <code>j</code>, <code>k</code>, and <code>l</code> in place of the arrow keys, as in <code>vim</code>.</p>
<p>You can also swap/reorder panes using <code>Ctrl-a J</code> and <code>Ctrl-a K</code>.</p>
</section>
<section id="resizing-panes" class="level2">
<h2>Resizing panes</h2>
<ul>
<li><code>Ctrl-a <</code> - move vertical split left</li>
<li><code>Ctrl-a ></code> - move vertical split right</li>
<li><code>Ctrl-a +</code> - move horizontal split up</li>
<li><code>Ctrl-a +</code> - move horizontal split down</li>
</ul>
<p>Note: You can click <code>Ctrl-a</code> once, and hold the second key for big moves.</p>
</section>
<section id="naming-finding-windows" class="level2">
<h2>Naming & finding windows</h2>
<ul>
<li><code>Ctrl-a ,</code> will let you name a window</li>
<li><code>Ctrl-a '</code> presents a list of windows (by name)</li>
<li><code><arrow></code> and <code>Enter</code> to switch to a window</li>
<li><code>Ctrl-a <numeric></code> switches to a window by number.</li>
</ul>
</section>
<section id="scrolling-and-copypaste-in-tmux" class="level2">
<h2>Scrolling and copy/paste in tmux</h2>
<p>When a noisy program floods a tmux pane, your mouse wheel won’t let you scroll, like in a normal shell session. Pressing <code>Ctrl-a [</code> will place you in scroll mode. Use can now use arrow keys or <code>Ctrl-u</code>/<code>Ctrl-d</code> to scroll through the history, and search with <code>/</code>.</p>
<p>From this mode, you can also press <code>Space</code> to enter copy-mode, <code><arrow></code> keys to specify a collection, and <code>Enter</code> to copy the selection. To paste the selection, use <code>Ctrl-]</code>.</p>
</section>
</section>
<section id="tmux-commands" class="level1">
<h1>Tmux commands</h1>
<p>You can also interact with tmux using commands, and you can see a list of commands and explanations on the man page:</p>
<pre><code>man tmux</code></pre>
<p>All of the key combos above are just bindings to these commands, so this is a good place to go if you’re trying to figure something out.</p>
</section>
<section id="detaching-and-attaching-a-tmux-session" class="level1">
<h1>Detaching and attaching a tmux session</h1>
<ol type="1">
<li>Close your terminal window, and ignore any warning prompts.</li>
<li>Reconnect just the way you did at the beginning of the class.</li>
<li>Type <code>tmux attach</code> to attach to an existing session.</li>
</ol>
<p><strong>Remember:</strong> <code>tmux attach</code> will fail if you don’t have a session open already; if that happens just enter <code>tmux</code> to start a new session.</p>
</section>
<section id="questions-3" class="level1">
<h1>Questions?</h1>
</section>
<section id="setting-up-our-project" class="level1">
<h1>Setting up our project</h1>
<p>This class builds around analysis of a <a href="http://dx.doi.org/10.1038/emi.2013.60">real world dataset</a> of <a href="https://en.wikipedia.org/wiki/Simian_foamy_virus">Simian Foamy Virus</a> (SFV). SFV is a retrovirus that infects non-human primates, but can infect humans bitten by NHP. Howver, we appear to be a “dead-end” host.</p>
<p>This data set looks at viruses sampled from humans and monkeys in Bangladesh.</p>
</section>
<section id="project-layout" class="level1">
<h1>Project layout</h1>
<p>Here’s how I typically organize things:</p>
<pre class="text"><code>your-project
├── README.md
├── build.sh
├── data
│ ├── sequences.fasta
│ └── metadata.csv
├── scripts
│ ├── clean.py
│ └── plot.R
└── output
├── alignment.fasta
├── cleaned_metadata.csv
├── tree.newick
└── tree_plot.png</code></pre>
<p>Note: this is a little different than the organization from the book; Use what works for you, but be consistent.</p>
</section>
<section id="setting-up-our-project-directory" class="level1">
<h1>Setting up our project directory</h1>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">mkdir</span> ~/bioinfclass
<span class="bu">cd</span> ~/bioinfclass
<span class="fu">mkdir</span> data output scripts
<span class="fu">ls</span></code></pre></div>
<p>(You’ll always enter in the things you see in these black boxes)</p>
</section>
<section id="download-data-with-wget" class="level1">
<h1>Download data with <code>wget</code></h1>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">wget</span> https://goo.gl/8Nk5tZ -O data.tar
<span class="fu">ls</span></code></pre></div>
<p>Note that we now have a <code>data.tar</code> file in this directory. This is an archive type (like <code>zip</code>) common on Unix systems. To unpack it</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">tar</span> -v -x -f data.tar</code></pre></div>
</section>
<section id="adding-a-readme" class="level1">
<h1>Adding a README</h1>
<p>Start vim with <code>vim README.md</code></p>
<ul>
<li>Type <code>i</code> to enter <em>insert mode</em></li>
<li>Enter some text about today’s lesson</li>
<li>Hit <code>Esc</code> to exit insert mode and enter <em>command mode</em></li>
<li>Type <code>: w <Enter></code> to save</li>
<li>When you are done editing, type <code>: q <Enter></code></li>
</ul>
</section>
<section id="lets-look-at-what-weve-done" class="level1">
<h1>Let’s look at what we’ve done</h1>
<p><code>tree</code> prints out a directory tree as ASCII art.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">
<span class="ex">tree</span></code></pre></div>
<p>Note: This may not turn out right on Windows PuTTY terminals.</p>
</section>
<section id="lets-explore-the-sequence-file" class="level1">
<h1>Let’s explore the sequence file</h1>
<p><code>cat</code> prints the output of file(s) to the screen.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">cat</span> data/sfv.fasta</code></pre></div>
</section>
<section id="now-with-less" class="level1">
<h1>Now with <code>less</code></h1>
<p><code>less</code> lets us “page” through data, without flooding the screen.</p>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">less</span> data/sfv.fasta</code></pre></div>
<p><br/></p>
<p>Press the <code>q</code> key to exit from <code>less</code>.</p>
</section>
<section id="now-lets-look-at-the-metadata" class="level1">
<h1>Now let’s look at the metadata</h1>
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="fu">less</span> data/sfv.csv</code></pre></div>
<p>Press the <code>/</code> key to enter a search string</p>
<p>(Try <code>human</code> or <code>monkey</code>; Use <code>n</code> and <code>N</code> to toggle through results).</p>
</section>
<section id="questions-4" class="level1">
<h1>Questions?</h1>
</section>
<section id="source-code" class="level1">
<h1>Source code!</h1>
<p>The source code for these slides is available on GitHub.</p>
<p><a href="https://github.com/fredhutchio/intro-bioinformatics" class="uri">https://github.com/fredhutchio/intro-bioinformatics</a></p>
<p>For the code that generated these slides, look at the <code>.mds</code> files in the <a href="https://github.com/fredhutchio/intro-bioinformatics/tree/gh-pages/src"><code>src</code></a> directory. (This code is an extension of Markdown, which we’ll look at more next week)</p>
<p>To submit issues or questions about the class, go to the <a href="https://github.com/fredhutchio/intro-bioinformatics/issues">Issues</a> page.</p>
</section>
<section id="homework" class="level1">
<h1>Homework</h1>
<p>Please, <em>please</em>, <em><strong>please!</strong></em></p>
<ul>
<li>Go over <code>tmux</code> and <code>vim</code> and memorize the basics of how to use them</li>
<li>Set up a routine for practice and tinkering</li>
<li>Pick a personal project</li>
</ul>
</section>
<section id="homework-1" class="level1">
<h1>Homework</h1>
<p>Recommended reading:</p>
<ul>
<li>Chapters 1 & 2 if you haven’t already.</li>
<li>Chapters 2 & 3 for basic Unix stuff & tmux.</li>
</ul>
<p>Reading for next class:</p>
<ul>
<li>Chapter 3, and chapter 7 (till around page 148).</li>
</ul>
</section>
<section id="resources" class="level1">
<h1>Resources</h1>
<ul>
<li>Class home page: <a href="http://fredhutchio.github.io/intro-bioinformatics" class="uri">http://fredhutchio.github.io/intro-bioinformatics</a></li>
<li>Polya: How to solve it <a href="https://en.wikipedia.org/wiki/How_to_Solve_It" class="uri">https://en.wikipedia.org/wiki/How_to_Solve_It</a></li>
<li>Unix command reference: <a href="https://ubuntudanmark.dk/filer/fwunixref.pdf" class="uri">https://ubuntudanmark.dk/filer/fwunixref.pdf</a></li>
<li>Tmux tutorial: <a href="http://www.fredhutch.io/articles/2014/04/27/terminal-multiplex" class="uri">http://www.fredhutch.io/articles/2014/04/27/terminal-multiplex</a></li>
<li>Stack overflow: <a href="https://stackoverflow.com" class="uri">https://stackoverflow.com</a></li>
<li>More on our data: http://dx.doi.org/10.1038/emi.2013.60</li>
</ul>
</section>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: false,
slideNumber: true,
rollingLinks: false,
// available themes are in /css/theme
theme: Reveal.getQueryHash().theme || 'csmall',
// default/cube/page/concave/zoom/linear/fade/none
transition: Reveal.getQueryHash().transition || 'fade',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML'}
// { src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'reveal.js/plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
Reveal.addEventListener( 'slidechanged', function( event ) {
MathJax.Hub.Rerender();
} );
</script>
</body>
</html>