User Tools

Site Tools


assignments:2020assignment4

Assignment 4

Due Date & Grading

  • Due date: Tuesday, September 8, 2020, 10am
  • Compile your answers in a text document
  • Upload your text document to CANVAS
  • Homework assignments account for 70% of your final grade.

:!: HINT: If the question asks for a command, write the full command as you would write it on the command line.

:!: HINT: You don't need to include the question in your write-up, just the answer.


Question 1

A. When you execute the command $ bash shelscript.sh, what parts of that line are the command, argument, or options?

B. When you execute the command $ ./shelscript.sh, what parts of that line are the command, argument, or options?

Question 2

A. Rewrite this sequence of commands into something that can be execute in one single line using pipes:

$ cut -f 2 listOfBreeds.txt > breed_column_tmp.txt
$ grep 'terrier' breed_columnn_tmp.txt > terriers_tmp.txt
$ wc terriers_tmp.txt

B. Rewrite the same sequence of commands into something that can be execute in one single line by chaining them together:

C. Are there any differences between the final output of the piped commands and the chained commands? (hint: you may need to make up your own example file listOfBreeds.txt)

Question 3

Write a bash script called reportDirectory.sh that does the following: 1) counts the number of fasta files in a directory 2) counts the number of gzipped fasta files in a directory 3) counts the number of txt files in a directory

The output should look like this:

$ reportDirectory.sh
reportDirectory >>> start report
The number of fasta files is:
     2
The number of gzipped fasta files is:
     2
The number of text files is:
     10
reportDirectory >>> report complete

For this homework assignment, turn in the TEXT of your code within your homework document demarked by lines of ###'s like so:

############################

#!/bin/bash

<code goes here>

############################

:!: Hint: you may have some stderr reporting when you run your script if there are 0 of a given file type. that is ok.

Question 4

  • Download all the chromosome files for the mm10 mouse genome located here http://hgdownload.soe.ucsc.edu/goldenPath/mm10/chromosomes/. Follow the directions to rsync or wget the whole mm10 chromosome files directory to your local computer (make sure to make a separate directory in which to house the information).
  • Use your reportDirectory.sh shell script from Question 3 to report the number of .txt, .fa, and .fa.gz files you downloaded.
  • For this homework question, list the output of your script.

Question 5

Write one question you have about the material covered in class so far. Please don't ask what will be on the test or what will be covered next in the course. Your questions can reflect something that still isn't clear to you regarding what we have already learned or it can be a question that is sparked from curiosity.

assignments/2020assignment4.txt · Last modified: 2021/06/01 15:06 (external edit)