Request of help for quality trimming of a fastq file I cannot understand how to develop it
1 answer
Honestly, there are a lot of issues with your script.
I would suggest you use strict; in addition to use warnings; (or perl -w as you are doing, but if I remember correctly the PERL docs recommend use warnings; instead) and use diagnose;.
Line 16 ( if(open(FASTQ,"<fosmid1.fastq")) ) is useless as you would have died if couldn't open FASTQ in line 6 ( open FASTQ, "<fosmid1.fastq" or die $!; ).
It is not incorrect per se to use <STDIN>, but I would prefer to read $kmer and $cut_off from @ARGV.
The following snippet does not work as you expect, see what I wrote above, and read some tutorial on reading files, e.g. this one.
while($header1 = <FASTQ>)
{
$dna = <FASTQ>;
$header1 = <FASTQ>;
$qual = <FASTQ>;
}
As the values being entered into the variables are not what you think they are, there is no point at this moment to comment further on your script. First make sure your are assigning the correct values to $header, $dna and $qual, then you should proceed further. Use print "$header"; etc to debug your code.
Log in to answer this question.
As this is an assignment (thank you for disclosing), don't expect direct answers, but we can nudge you into the right direction.
The snippet of code you posted makes no sense. Post your code on pastebin or github gist, then we can help. Here are two tips:
1) perl by default reads files
one line at a time(not true, but you can ignore this for now, it is mostly true).2) fastq files are organized in sets of four lines.
Use these two facts to correctly assign
$header,$dnaand$qual.Thank you for your reply! I modified my question adding the program I wrote.
This is one of the two versions I made. The first one differs only for how I open the fastq file (I used $file = shift at the beginning). However of the two versions, this one I posted is one that "sounds better" to me (I don't know how to explain it).
uruboro : Once you ask a question/post your code you should not remove either of those things. Doing so makes this thread orphan. Now @h.mon's answer has no reference.
I realize choice of language is a matter of personal preference, but I'd strongly suggest not going for Perl. The language has been absolutely wonderful for bioinformatics and quite some (legacy) software is written in Perl. It's obviously a powerful language with nice options. But you would be so much better off if you would go for Python (or R).
But perhaps your homework requires you to use Perl. Time to riot.
Thank you for your reply!
unfortunately I have to use Perl as it is an assignment...
Hello uruboro!
Note: I am going to close this question until you restore your code/details that the original post had. Once you restore the details the thread will be re-opened.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!