rmc@codon2 public_html]$ /usr/bin/perl new.pl~

What is the name of your DNA sequence file?

 test.seq

 

What should I call the output file?

 test.aa

[rmc@codon2 public_html]$ ls -l

----------------

drwxr-xr-x    2 rmc      rmc          4096 Mar 13 15:09 cgi-bin

-rwxr-xr-x    1 rmc      rmc             9 Mar 13 15:06 cliff.pep

-rwxr-xr-x    1 rmc      rmc          3536 Mar 13 15:06 dataextraction.pl

-rwxr-xr-x    1 rmc      rmc          3536 Mar 13 15:06 dataextraction.pl~

-rwxr-xr-x    1 rmc      rmc           170 Mar 14 10:55 index.html

-rwxr-xr-x    1 rmc      rmc           172 Mar 13 15:07 index.html~

-rwxr-xr-x    1 rmc      rmc          1433 Mar 13 15:06 new.pl~     ********

-rw-rw-r--    1 rmc      rmc             9 Mar 14 12:11 test.aa?.pep

-rwxr-xr-x    1 rmc      rmc            25 Mar 13 15:06 test.seq        *********

-rwxr-xr-x    1 rmc      rmc          1426 Mar 13 15:06 translate.pl

[rmc@codon2 public_html]$ cat test.aa*

MTTPWHI*

-rwxrwxr-x    1 rmc      rmc          2976 Mar 13 15:09 form

-rw-rw-r--    1 rmc      rmc           112 Mar 13 15:09 test2.pl

-rw-rw-r--    1 rmc      rmc           119 Mar 13 15:09 test2.pl~

-rw-rw-r--    1 rmc      rmc            39 Mar 13 15:09 testing.pl

-rwxrwxr-x    1 rmc      rmc          5289 Mar 14 11:03 translate.pl

-rwxrwxr-x    1 rmc      rmc          5077 Mar 13 15:09 translate.pl~

 [rmc@codon2 cgi-bin]$ chmod 755 ./*

[rmc@codon2 cgi-bin]$ ls –l

 

[rmc@codon2 public_html]$ ls -l

total 24

drwxr-xr-x    2 rmc      rmc          4096 Mar 14 13:45 cgi-bin

-rwxr-xr-x    1 rmc      rmc           170 Mar 14 10:55 index.html

-rwxr-xr-x    1 rmc      rmc           172 Mar 13 15:07 index.html~

-rwxr-xr-x    1 rmc      rmc          1433 Mar 13 15:06 new.pl~

-rw-rw-r--    1 rmc      rmc             9 Mar 14 13:37 out1?.pep

-rwxr-xr-x    1 rmc      rmc            25 Mar 13 15:06 test.seq

[rmc@codon2 public_html]$ cat new.pl~ > microtrans.pl

[rmc@codon2 public_html]$ ls -l

drwxr-xr-x    2 rmc      rmc          4096 Mar 14 13:45 cgi-bin

-rwxr-xr-x    1 rmc      rmc           170 Mar 14 10:55 index.html

-rwxr-xr-x    1 rmc      rmc           172 Mar 13 15:07 index.html~

-rw-rw-r--    1 rmc      rmc          1433 Mar 14 13:49 microtrans.pl

-rwxr-xr-x    1 rmc      rmc          1433 Mar 13 15:06 new.pl~

-rw-rw-r--    1 rmc      rmc             9 Mar 14 13:37 out1?.pep

-rwxr-xr-x    1 rmc      rmc            25 Mar 13 15:06 test.seq

[rmc@codon2 public_html]$ cat new.pl~ (earlier copied it to microtrans.pl

 

perl script below for new.pl~ and/or microtrans.pl

#!/usr/bin/perl

print "What is the name of your DNA sequence file?\n ";

$file=<STDIN>;

open(SEQFILE,"$file");

$sequence=<SEQFILE>;

chop $sequence;

close(SEQFILE);

print "\n\nWhat should I call the output file?\n ";

$outfile=<STDIN>;

open(PEPFILE,">>$outfile".".pep");

 

%code=

("TTT"=>"F","TTC"=>"F","TTA"=>"L","TTG"=>"L","CTT"=>"L","CTC"=>"L","CTA"=>"L","CTG"=>"L",

 "ATT"=>"I","ATC"=>"I","ATA"=>"I","ATG"=>"M","GTT"=>"V","GTC"=>"V","GTA"=>"V","GTG"=>"V",

 "TCT"=>"S","TCC"=>"S","TCA"=>"S","TCG"=>"S","CCT"=>"P","CCC"=>"P","CCA"=>"P","CCG"=>"P",

 "ACT"=>"T","ACC"=>"T","ACA"=>"T","ACG"=>"T","GCT"=>"A","GCC"=>"A","GCA"=>"A","GCG"=>"A",

 "TAT"=>"Y","TAC"=>"Y","TAA"=>"*","TAG"=>"*","CAT"=>"H","CAC"=>"H","CAA"=>"Q","CAG"=>"Q",

 "AAT"=>"N","AAC"=>"N","AAA"=>"K","AAG"=>"K","GAT"=>"D","GAC"=>"D","GAA"=>"E","GAG"=>"E",

 "TGT"=>"C","TGC"=>"C","TGA"=>"*","TGG"=>"W","CGT"=>"R","CGC"=>"R","CGA"=>"R","CGG"=>"R",

 "AGT"=>"S","AGC"=>"S","AGA"=>"R","AGG"=>"R","GGT"=>"G","GGC"=>"G","GGA"=>"G","GGG"=>"G");

 

    for ($count=0; $count<length($sequence); $count++) {

        $pointer=$count*3;

        $codon=substr($sequence,$pointer,3);

        $this{$codon}++;                   ## tablulate codon usage

        $residue=$code{$codon};

        $peptide.=$residue;                ## append residue onto translation

        $composition{$residue}++;          ## tabulate amino acid composition

    }

 

 

    print PEPFILE "$peptide\n";

 

[rmc@codon2 public_html]$ cat test.seq

ATGACTACACCGTGGCATATCTGA

[rmc@codon2 public_html]$ cat out*

MTTPWHI*