IUBio GIL .. BIOSCI/Bionet News .. Biosequences .. Software .. FTP

Reverse Complement

Mario Pinelli pinelli at uniwa.uwa.edu.au
Sun Sep 13 01:24:45 EST 1992

In <1992Sep10.165929.3773 at magnus.acs.ohio-state.edu> gchacko at magnus.acs.ohio-state.edu (George W Chacko) writes:

>I need to generate the reverse complement of a DNA sequence on a Unix
>machine. Transferring the file to a VAx and using GCG is laborious.

Try the following 'one-liner':

tail -r INPUTFILE | rev | tr atgcATGC tacgTACG > OUTPUTFILE

It should do what you ask.  Your input file must contain DNA sequence only,
comment lines beginning with '>' are NOT ignored and will be read as sequence. 
I could probably find a way to handle that if required.

If you want to put this into a script file try:

if test $1                                          
        tail -r $1 | rev | tr atgcATGC tacgTACG >$1.rev
        echo "usage: $0 <dna_sequence_file>"        

Make the file executable with the command 'chmod 755 script-flie'.  It will
produce an output file with the extension .rev when called from the
command line, e.g.  revcomp humtnfa    ==produces==>  humtnfa.rev
I'm currently working on some other unix scripts for simple sequence 
manipulation based on traditional unix commands.  Does anyone have
any suggestions? ...dare I ask!

Mario Pinelli                  (pinelli at murdoch.edu.au)

Biotechnology Programme,
Murdoch University,
Murdoch, W.A., 6150,

More information about the Bio-soft mailing list

Send comments to us at archive@iubioarchive.bio.net