Skip to content

Commit 12d2eda

Browse files
committed
update 03-working-with-files
1 parent 1ac96c1 commit 12d2eda

1 file changed

Lines changed: 64 additions & 13 deletions

File tree

_episodes/03-working-with-files.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ $ ls /usr/bin/*.sh
8787
~~~
8888
{: .bash}
8989

90+
~~~
91+
/usr/bin/amuFormat.sh /usr/bin/gettext.sh /usr/bin/gvmap.sh
92+
~~~
93+
{: .output}
94+
9095
Lists every file in `/usr/bin` that ends in the characters `.sh`.
9196

9297
> ## Home vs. Root
@@ -207,7 +212,7 @@ This will print out all of the contents of the `SRR098026.fastq` to the screen.
207212
>
208213
> > ## Solution
209214
> > 1. The last line of the file is `TATTTTAAAATGGAATACCTAACATGTTAATTAACC`.
210-
> > 2. cat ~/dc_sample_data/untrimmed_fastq/*
215+
> > 2. `cat ~/dc_sample_data/untrimmed_fastq/*`
211216
> {: .solution}
212217
{: .challenge}
213218

@@ -253,10 +258,10 @@ return, you will search backwards and move up the file to previous examples of t
253258

254259
> ## Exercise
255260
>
256-
> What are the next three nucleotides (characters) after the sequence quoted above?
261+
> What are the next three nucleotides (characters) after the first instance of the sequence quoted above?
257262
>
258263
> > ## Solution
259-
> > `TCA`
264+
> > `CAC`
260265
> {: .solution}
261266
{: .challenge}
262267

@@ -273,20 +278,65 @@ the beginning and end of a file, respectively.
273278

274279
~~~
275280
$ head SRR098026.fastq
281+
~~~
282+
{: .bash}
283+
284+
~~~
285+
@SRR098026.1 HWUSI-EAS1599_1:2:1:0:968 length=35
286+
NNNNNNNNNNNNNNNNCNNNNNNNNNNNNNNNNNN
287+
+SRR098026.1 HWUSI-EAS1599_1:2:1:0:968 length=35
288+
!!!!!!!!!!!!!!!!#!!!!!!!!!!!!!!!!!!
289+
@SRR098026.2 HWUSI-EAS1599_1:2:1:0:312 length=35
290+
NNNNNNNNNNNNNNNNANNNNNNNNNNNNNNNNNN
291+
+SRR098026.2 HWUSI-EAS1599_1:2:1:0:312 length=35
292+
!!!!!!!!!!!!!!!!#!!!!!!!!!!!!!!!!!!
293+
@SRR098026.3 HWUSI-EAS1599_1:2:1:0:570 length=35
294+
NNNNNNNNNNNNNNNNANNNNNNNNNNNNNNNNNN
295+
~~~
296+
{: .output}
297+
298+
~~~
276299
$ tail SRR098026.fastq
277300
~~~
278301
{: .bash}
279302

303+
~~~
304+
+SRR098026.247 HWUSI-EAS1599_1:2:1:2:1311 length=35
305+
#!##!#################!!!!!!!######
306+
@SRR098026.248 HWUSI-EAS1599_1:2:1:2:118 length=35
307+
GNTGNGGTCATCATACGCGCCCNNNNNNNGGCATG
308+
+SRR098026.248 HWUSI-EAS1599_1:2:1:2:118 length=35
309+
B!;?!A=5922:##########!!!!!!!######
310+
@SRR098026.249 HWUSI-EAS1599_1:2:1:2:1057 length=35
311+
CNCTNTATGCGTACGGCAGTGANNNNNNNGGAGAT
312+
+SRR098026.249 HWUSI-EAS1599_1:2:1:2:1057 length=35
313+
A!@B!BBB@ABAB#########!!!!!!!######
314+
~~~
315+
{: .output}
316+
280317
The `-n` option to either of these commands can be used to print the
281-
first or last `n` lines of a file. To print the first/last line of the
282-
file use:
318+
first or last `n` lines of a file.
283319

284320
~~~
285321
$ head -n 1 SRR098026.fastq
322+
~~~
323+
{: .bash}
324+
325+
~~~
326+
@SRR098026.1 HWUSI-EAS1599_1:2:1:0:968 length=35
327+
~~~
328+
{: .output}
329+
330+
~~~
286331
$ tail -n 1 SRR098026.fastq
287332
~~~
288333
{: .bash}
289334

335+
~~~
336+
A!@B!BBB@ABAB#########!!!!!!!######
337+
~~~
338+
{: .output}
339+
290340
## Creating, moving, copying, and removing
291341

292342
Now we can move around in the file structure, look at files, search files, and
@@ -304,7 +354,7 @@ and change the file permissions so that we can read from, but not write to, the
304354

305355
First, let's make a copy of one of our FASTQ files using the `cp` command.
306356

307-
Navigate to the `data` directory and enter:
357+
Navigate to the `dc_sample_data/untrimmed_fastq` directory and enter:
308358

309359
~~~
310360
$ cp SRR098026.fastq SRR098026-copy.fastq
@@ -374,7 +424,7 @@ $ ls -l
374424
{: .bash}
375425

376426
~~~
377-
-rw-r--r-- 1 dcuser dcuser 43421 Jul 30 15:28 SRR098026-backup.fastq
427+
-rw-r--r-- 1 dcuser dcuser 43332 Nov 15 23:02 SRR098026-backup.fastq
378428
~~~
379429
{: .output}
380430

@@ -398,7 +448,7 @@ $ ls -l
398448
{: .bash}
399449

400450
~~~
401-
-r--r--r-- 1 dcuser dcuser 43421 Jul 30 15:28 SRR098026-backup.fastq
451+
-r--r--r-- 1 dcuser dcuser 43332 Nov 15 23:02 SRR098026-backup.fastq
402452
~~~
403453
{: .output}
404454

@@ -407,14 +457,14 @@ $ ls -l
407457
To prove to ourselves that you no longer have the ability to modify this file, try deleting it with the `rm` command.
408458

409459
~~~
410-
$ rm backup/SRR098026-backup.fastq
460+
$ rm SRR098026-backup.fastq
411461
~~~
412462
{: .bash}
413463

414464
You'll be asked if you want to override your file permissions.
415465

416466
~~~
417-
override r--r--r-- dcuser/dcuser backup/SRR098026-backup.fastq?
467+
rm: remove write-protected regular file ‘SRR098026-backup.fastq’?
418468
~~~
419469
{: .output}
420470

@@ -431,7 +481,8 @@ we just made.
431481
Enter the following command:
432482

433483
~~~
434-
rm -r backup
484+
$ cd ..
485+
$ rm -r backup
435486
~~~
436487
{: .bash}
437488

@@ -457,8 +508,8 @@ you will be asked whether you want to override your permission settings.
457508
> > It's always a good idea to check your work with `ls -l backup`. You should see something like:
458509
> >
459510
> > ~~~
460-
> > -r--r--r-- 1 dcuser dcuser 47649 Oct 20 16:59 SRR097977-backup.fastq
461-
> > -r--r--r-- 1 dcuser dcuser 43421 Oct 20 16:59 SRR098026-backup.fastq
511+
> > -r--r--r-- 1 dcuser dcuser 47552 Nov 15 23:06 SRR097977-backup.fastq
512+
> > -r--r--r-- 1 dcuser dcuser 43332 Nov 15 23:06 SRR098026-backup.fastq
462513
> > ~~~
463514
> > {: .output}
464515
> {: .solution}

0 commit comments

Comments
 (0)