If your trouble still exists, as @Ram said, maybe Invisible characters, check your file with command cat -A xx.fq
• 0 views
•
link
Hello, I need to modify the third line of the fastq to keep only the + symbol. The library I downloaded from SRA has the + with the header and this is causing some troubles when using this library.
Can someone help me with this change?
Thanks in advance
sed can do this:
sed '3~4s/.+/+/' in.fastq > out.fastq #untested, test on the first ~40 lines before running on entire file
perl:
perl -e 'open A,shift; my $idx=0; while(<A>){$idx++; $idx==3 ? print "+\n" : print "$_"; $idx==4 ? $idx=0 : $idx;} close A;' test.fq
Log in to answer this question.
It's surprising there is a problem, because the FASTQ specs say it is absolutely legal to look like that, so long as the content after the + is identical to the content after the @.
Could it be problematic line endings? Invisible characters?
Thank you all for the responses and contributions, the Perl code size_t wrote worked just fine :)