Hi all,
I have defined some array variables a
*************** *************** ***********
*************** *************** *************** **********
and also created a hash to store the arrays in it and finally I wanted to do a foreach loop over the desired input say for example input=VEFCDAMP and to create all possible permutation of the word taken from the definition from dictionary as defined in the array.
The following is the perl script that I conceived to do the job but I am confused here how to use the forloop here to iterate through this and make permutation,
*************** *************** *************** ***************
*************** *************** *************** *************** *****
to run this program please create and save a txt file with the content of word VEFCDAMP in it.
I want my program to perform simillar task what the following program does it for
*************** *************** *************** *************** ****
*************** *************** *************** *************** **
Thanks in advance,
B.Nataraj
I have defined some array variables a
*************** *************** ***********
Code:
@L=('CTT','CTC','CTA','CTG','TTA','TTG');
@S=('TCT','TCC','TCA','TCG','AGT','AGC');
@R=('CGT','CGC','CGA','CGG','AGA','AGG');
@V=('GTT','GTC','GTA','GTG');
@A=('GCT','GCC','GCA','GCG');
@G=('GGT','GGC','GGA','GGG');
@P=('CCT','CCC','CCA','CCG');
@T=('ACT','ACC','ACA','ACG');
@I=('ATT','ATC','ATA');
@F=('TTT','TTC');
@C=('TGT','TGC');
@Y=('TAT','TAC');
@Q=('CAA','CAG');
@N=('AAT','AAC');
@H=('CAT','CAC');
@E=('GAA','GAG');
@D=('GAT','GAC');
@K=('AAA','AAG');
@M=('ATG');
@W=('TGG');
and also created a hash to store the arrays in it and finally I wanted to do a foreach loop over the desired input say for example input=VEFCDAMP and to create all possible permutation of the word taken from the definition from dictionary as defined in the array.
The following is the perl script that I conceived to do the job but I am confused here how to use the forloop here to iterate through this and make permutation,
*************** *************** *************** ***************
Code:
print "\n\n\t\#################### AA 2 PROTEIN #################### \n\n";
print "This script will convert your amino acid sequence to DNA Sequence\n\n";
print "ENTER THE FILENAME OF THE Amino acid SEQUENCE:= ";
$aafilename = <STDIN>;
chomp $aafilename;
unless ( open(aaFILE, $aafilename) ) {
print "Cannot open file \"$aafilename\"\n\n";
}
@aa = <aaFILE>;
close aaFILE;
$aa = join( '', @aa);
print " \nThe original AA file is:\n$aa \n";
$aa =~ s/\s//g;
@aa=$aa;
my $protein='';
my $codon;
@L=('CTT','CTC','CTA','CTG','TTA','TTG');
@S=('TCT','TCC','TCA','TCG','AGT','AGC');
@R=('CGT','CGC','CGA','CGG','AGA','AGG');
@V=('GTT','GTC','GTA','GTG');
@A=('GCT','GCC','GCA','GCG');
@G=('GGT','GGC','GGA','GGG');
@P=('CCT','CCC','CCA','CCG');
@T=('ACT','ACC','ACA','ACG');
@I=('ATT','ATC','ATA');
@F=('TTT','TTC');
@C=('TGT','TGC');
@Y=('TAT','TAC');
@Q=('CAA','CAG');
@N=('AAT','AAC');
@H=('CAT','CAC');
@E=('GAA','GAG');
@D=('GAT','GAC');
@K=('AAA','AAG');
@M=('ATG');
@W=('TGG');
$L=\@L;
$S=\@S;
$R=\@R;
$V=\@V;
$A=\@A;
$G=\@G;
$P=\@P;
$T=\@T;
$I=\@I;
$F=\@F;
$C=\@C;
$Y=\@Y;
$Q=\@Q;
$N=\@N;
$H=\@H;
$E=\@E;
$D=\@D;
$K=\@K;
$M=\@M;
$W=\@W;
%hash = (L=>$L,S=>$S,R=>$R,V=>$V,A=>$A,G=>$G,P=>$P,T=>$T,I=>$I,F=>$F,C=>$C,Y=>$Y,Q=>$Q,N=>$N,H=>$H,E=>$E,D=>$D,K=>$K,M=>$M,W=>$W);
$hash_ref=\%hash;
my @aa_split = split //, $aa;
foreach my $val (@{hash{@aa_split}})
{
print "@{$val} ";
}
print " \n";
to run this program please create and save a txt file with the content of word VEFCDAMP in it.
I want my program to perform simillar task what the following program does it for
*************** *************** *************** *************** ****
Code:
use strict;
use warnings;
my @V=('GTT','GTC','GTA','GTG');
my @A=('GCT','GCC','GCA','GCG');
my @E=('GAA','GAG');
my @F=('TTT','TTC');
my @G=('GGT','GGC','GGA','GGG');
my @H=('CAT','CAC');
my $i = 1;
foreach my $v (@V) {
foreach my $a (@A) {
foreach my $e (@E) {
foreach my $f (@F) {
foreach my $g (@G) {
foreach my $h (@H) {
print "$i $v$a$e$f$g$h\n";
$i++;
}
}
}
}
}
}
Thanks in advance,
B.Nataraj
Comment