correct fastq file with SED
2
0
Entering edit mode
9.5 years ago
Siva ▴ 20

Hi friends,

Got a small problem because of my fastq file which is wrong. So I wanted to correct lines manually.

For example I got these lines in my test.fasq file:

@HWI-ST1194:55:C11P5ACXX:4:2316:21380:54479/2
ATAATCTTCCCCAAGCATGGAACAAATACTCTCTTTAGTGGACTTGCATAACCTACAAAAAAACCTTCGTTAACTTT
+
@#1==DDAFFFD=EFFB1CGEEFECFFGIIIIIEGII?DFECEEFDEAFEEII;?A1([M::main_bam2fq] discarded 8840174

Wanted to replace the last line by a real quality :

@@BFFFFFHFFHBFHHIBEE>GIGHEHG+CG3CFFGGIIDBDGGGFDFGEDFHGCCGHEFHE;7@DEDFDACCECDC>

So my command line:

sed '4 s/@#1==DDAFFFD=EFFB1CGEEFECFFGIIIIIEGII?DFECEEFDEAFEEII;?A1([M::main_bam2fq] discarded 8840174/*@@BFFFFFHFFHBFHHIBEE>GIGHEHG+CG3CFFGGIIDBDGGGFDFGEDFHGCCGHEFHE;7@DEDFDACCECDC>*/g' test1

What's wrong ? Or can I proceed with perl maybe?

Thanks

fastq bash sequence • 2.3k views
ADD COMMENT
0
Entering edit mode

please, format your post. It's hard to see what's wrong.

ADD REPLY
0
Entering edit mode

Hi Pierre,

I've put it here:

ADD REPLY
2
Entering edit mode
9.5 years ago
PoGibas 5.1k

Try escaping [ ] ([M::main_bam2fq]).

sed 's/@#1==DDAFFFD=EFFB1CGEEFECFFGIIIIIEGII?DFECEEFDEAFEEII;?A1(\[M::main_bam2fq\] discarded 8840174/real quality/'​
ADD COMMENT
0
Entering edit mode

Great :) it works !

Thanks again Pgibas.

Siva

ADD REPLY
0
Entering edit mode
9.5 years ago

If you just want to replace the last line I wouldn't use find & replace but be more explicit and actually print the all file without last line and append as last line what you want. Something like:

nlines=`wc -l in.fq | awk '{print $1-1}'`
head -n $nlines in.fq > out.fq
echo 'myNewLineWithQualities' >> out.fq
ADD COMMENT
0
Entering edit mode

nope it's not the last line, here for the example yea but in my real data not.

ADD REPLY

Login before adding your answer.

Traffic: 1029 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6