Hi! :) I'm new here and I'm also at my first approaches to Bioinformatics. I found this Perl script and I don't really understand all the passages, in particular in the end. Could someone explain me it, maybe telling me why programmers used these ways to write the script and not others? I know maybe this is not a real good question but I'd really like to understand this script and I don't know how to do it... I have already search for the meanings of the different features in the manual but I can't understand why some of them have been applied here... Thank you very much and I hope you could understand my English!

Update: crossposted here http://www.biostars.org/p/297182/

$file=shift; print "Window length\n"; $kmer=<STDIN>; chomp ($kmer); print "Minimum quality score cut-off\n"; $cut_off=<STDIN>; chomp ($cut_off); open (MYFILE, ">R.txt"); if (open(FASTQ,$file)) { while($header1=<FASTQ>) { $dna=<FASTQ>; $header2=<FASTQ>; $qual=<FASTQ>; @dna=split ('', $dna); @qual=split ('', $qual); @num_value=(); @scores=(); foreach $qscore (@qual) { $num_value=ord($qscore)-33; push(@num_value, $num_value); } foreach $value (@num_value) { if ($value<$cut_off){ pop(@qual); + }else{ last; } } $sub1=substr($dna,-$#qual); $sub11=substr($qual,-$#qual); @qscopy=reverse @num_value; foreach $value (@qscopy) { if ($value<$cut_off){ pop(@qual); }else{ last; } } $sub2=substr($sub1,0,$#qual); $sub22=substr($sub11,0,$#qual); for ($i=0;$i<=$#qual-($kmer-1);$i++) { @scores=@num_value[$i..$i+$kmer-1]; $sum=0; foreach $score (@scores) { $sum+=$score; } if (($sum/$kmer)<$cut_off){ last; } } $sub3=substr($sub2,0,($i-1)); $sub33=substr($sub22,0,($i-1)); print MYFILE "$header1$sub3\n$header2$sub33\n\n"; } }else{ print "Error!\n"; } close MYFILE;

In reply to explanation of passages of a Perl script by uuuiii

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.