Shell command to print the number of occurrences of chromosomes

  The following is a text file containing human genetics data.

http://svn.software-carpentry.org/swc/data/1000gp.vcf 

Here is the command to print the number of 
occurrences of chromosomes from the above data file:
grep -v "^#" 1000gp.vcf| cut -f 1 | sort | uniq -c

Here a pipeline symbol '|' is used to combine 
several commands into a single one. A pipe uses
output of the command on its left side as the
input to its right side.

Now let's see the use of each keyword in the command. 
grep -v "^#" is used to print the lines other than
header files,i.e lines which are not starting with 
"#" from the given file.cut -f 1 is used to select 
only the first field from its input.sort is used to
sort the lines in the ascending order.uniq -c is 
used to print the number of occurrences by omitting 
the repeated value.
Thus the final result will be the list of unique 
chromosomes ,each of with their number of occurrences.
Advertisements

About ramyabkrishna

I am Ramya B Krishna doing MCA at GEC Thrissur. I am now in the process of taking a Leap into the world of Linux and hoping to do a few projects as well.

Posted on May 13, 2011, in Uncategorized. Bookmark the permalink. Leave a comment.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: