I cant seem to see why this simple looping system wont play properly.
I want it to loop through an array full of DNA sequences. For each sequence i want another array full of enzyme names to "cut" the sequence. The outer loop then should go to the next element in the array to get the second sequence.... but it doesnt :(
Can people see why..... i cant. Boo hoo.
############ outer loop################### foreach my $fileSeq(@sequences) # loop through all the sequences { $counter++; $seqobj = ''; print("<BR>$counter<BR>"); $seqobj = Bio::PrimarySeq->new ( -seq => $fileSeq, -alphabet => 'd +na'); # create an object of the sequence print("<BR>Sequence object created....all going well so far...<BR> +"); ############ inner loop ################### foreach $element(@enzymes) # look through all the enzymes for eac +h sequence { $newObject = ''; $newObject = new Bio::Tools::RestrictionEnzyme(-NAME =>$element) +; # create an object of the enzyme print("<BR>Enzyme object created for enzyme : $element<BR>"); $cutSeq = $newObject->site(); + # show the cut site for the enzyme $anotate = $newObject->annotate_seq($seqobj); + # annotate the sequence at cut site print("<BR>Sequence virtually labelled....<BR>"); @cut = $newObject->cut_seq($seqobj); +# virtualy cut the sequnce using the enzyme print("<BR>Sequence virtually cut....<BR>"); print("<TABLE BORDER=2>"); # + produce output print("<TR><TD><B>Sequence number $counter</B></TR></TD>"); print("<TR><TD>"); print("The cleavage site is $cutSeq for enzyme $element denoted +by \" ^ \"<BR></TD></TR>"); print("<TR><TD>The annotated sequence is given below along with +the digested sequence<BR>"); print("<B>Annotated:</B>$anotate<BR>"); print("<B>Digested:</B>@cut</TD></TR>"); print("</TABLE><BR><BR>"); } ############ END inner loop ################### print("Loop finished... returning to the start<BR>"); }############ END outer loop ###################
20050516 Edit by castaway: Changed title from 'Why it not work :('
In reply to Looping failure by MonkPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |