Testing commands

Today I found myself analyzing one of my many datasets.  I spent the day writing a script that would allow me to search through my datasets and pull out sequence reads that contained a particular sequence I am interested in.  Something I learned early on when running commands in the terminal or running a script…you will screw it up the first time.  That is just fact.  Even when I spend 5 minutes staring at the computer screen double- and triple-checking what I wrote down, as soon as I hit enter I either 1. get an error, or 2. the output file contains 0 bytes (no bueno).  So I always advise fellow students to make a fake text file.  In my case, I’m searching for a particular sequence within a dataset, so I make a fake fastq file. I usually call it test.fastq, nothing fancy.  I then run my script and look at the output.  This allows you to fix any problems you could have if the script doesn’t perform the task correctly.  If the script fails make sure to walk away from the computer screen for 5 minutes to rest your eyes and mind, then come back and check your script.  Most mistakes I make are forgetting just one letter in the command or not putting all the letters in uppercase.  The mistake is usually something minor.  So pay attention to the details!  Best of luck to everyone making their first scripts!  


1 thought on “Testing commands

  1. Michael H

    Great advice! an easy way to make a quick run through your data is using the head command. Simply say $: head -n [number of lines you want [path]/filename > [output file name] this can make a quick little file for you so you can test your scripts. You are definitely right, they probaly will never work the first time


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s