Reverse DNA sequence

by Knud Christensen

return

A program for reversing a DNA sequence - input one line per seqquence two xx in front of the sequence if text contain minus the sequence is reversed, if reversed minus is replaced by Plus-



#!/usr/bin/perl -w
#conc2fasta.pl
#input one line per seq. two xx in front of seq if text contain minus the sequence is reversed

while (<>){  
	       
               if (/Minus|minus/) {s/Minus/Plus-/i;s/xx(.*)/xx/; $seq=reverse(uc($1));$seq =~ s/\n//;$seq =~ s/$/\n/;
               $seq =~ s/A/t/g; $seq =~ s/T/a/g; $seq =~ s/G/c/g; $seq =~ s/C/g/g; 
                                                                                          $a=uc($seq); s/xx/xx$a/;chomp; 
				if(/Sbjct/){	$b=length($a);  s/Sbjct\: (\d+)/$&/;  $c=$1-$b; 
								  s/Sbjct\: (\d+)/Sbjct\: $c/;}    }
print $_;
		     }

Example:

Input

>test sequence minus xxctttttcaggacttaatgttgaaggaagcacacattcactagttttagatgccactgtct

Output

>test sequence Plus- xxAGACAGTGGCATCTAAAACTAGTGAATGTGTGCTTCCTTCAACATTAAGTCCTGAAAAAG