#!/usr/bin/perl -w print "Please enter the name of the genome file:\n"; $fname=; chop($fname); $fnamedeal = "01".$fname.".txt"; open(FH, $fname); $text = SeqFromFile($fname); close FH; open(SAVE,">$fnamedeal"); $a = $text =~ s/a/01/gi; $c = $text =~ s/c/11/gi; $g = $text =~ s/g/00/gi; $t = $text =~ s/t/10/gi; $n = $text =~ s/n/--/gi; $total=$a+$c+$g+$t+$n; print SAVE ("a-01: $a\nc-11: $c\ng-00: $g\nt-10: $t\nn---: $n\nTOTAL: $total\n\n01_Code: \n$text\n"); close SAVE; #Converts sequence files to a string. Assumes the first line is #the header, which it removes, and it removes linebreaks. sub SeqFromFile { my $fname= $_[0]; open(FH, $fname); local $/; my $data = ; $data =~ s/\>.+?\n//; $data =~ s/\n//g; return $data; }