Hello y'all,

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.