User Tools

Site Tools



Due date: 9/12 by 10 am

A sample sequence file, sequence.txt, is available in the sample data directory.

Exercise: bash scripting

Assignment. Create a bash script that prompts the user for the name of a file containing a sequence and then determines the following and prints the results to the terminal:

  1. The length of the sequence
  2. The reverse of the sequence
  3. The complement of the sequence
  4. The reverse complement of the sequence
  • Using a conditional statement, determine if the sequence contains non-DNA/RNA characters and print a warning message to the terminal if it does.
  • Add a while loop to repeat indefinitely.
  • Return the output to the shell.
  • Save the script as
  • Execute the script from the command line.
  • Submit the script on Canvas.

The challenge will be to figure out how to perform these operations on the contents of a file. You may want to generate a text file containing an ~20 nt sequence to use in the exercise.

* Further enrichment (not graded): using a conditional statement and the command exit, write a script that determines the reverse complement of a sequence input from the command line (as opposed to from a file) and exits with a warning message if it encounter non-DNA/RNA characters. As we did not cover the command exit in class, you may want to google search it, although you could probably figure it out on your own.

assignments/2016assignment4.txt ยท Last modified: 2017/09/07 08:44 by tai