I want to write a quick single-line perl script to produce the reverse complement of a sequence of DNA. The following isn't working for me, however:
$ cat sample.dna.sequence.txt | perl -ne '{while (<>) {$seq = $_; $seq =~ tr /atcgATCG/tagcTAGC/; $revComp = reverse($seq); print $revComp;}}'
Any suggestions?
The simpler version is:
cat test.txt | perl -pe 'chomp;tr/ACGTacgt/TGCAtgca/;$_=reverse."\n"'
an even simpler version is
cat test.txt | perl -pe 'tr/ACGTacgt/TGCAtgca/;reverse'