Thank you so much for kind support. im newbie to NGS and linux and interested to know that Is it possible to remove specific reads using linux commands only rather to use ant toolkit. thank
removal of spesific read from fastq file
Hellow, Can someone kindly let me know that how to remove a specific read from paired end fastq file using awk or any other command...???
• 6,333 views
•
link
1 answer
• 0 views
•
link
Assuming that you have fastq gzipped,
$ zgrep "@" input.fastq.gz | grep -v "<readname to be excluded>" | while read line; do zgrep -A 3 $line input.fastq.gz ; done
- First argument zgreps @ in each line. This is to print all the headers.
- Second argument searches all the headers that doesn't match the provided read name
- Here, zgrep can be used. However, zgrep seems to have some limitations. Hence a while loop. If you do not like loop, you can use parallel (GNU-parallel available in most of the distros)
Please direct the output to a file of your choice
$ zgrep "@" input.fastq.gz | grep -v "<readname to be excluded>" | parallel zgrep -A 3 {} input.fastq.gz
If you have fastq unzipped, try this:
$ sed -n '/@/!d; /< read name>/!p' test.fastq | grep -A 3 -f - test.fastq
(note: if sample read id contains strand information (/1 or /2), make sure that they are escaped. For eg. if read id is K00193:38:H3MYFBBXX:4:2119:24527:21657/1, sed command would be:
$ sed -n '/@/!d; /K00193:38:H3MYFBBXX:4:2119:24527:21657\/1/!p' test.fastq | grep -A 3 -f - test.fastq
• 0 views
•
link
Log in to answer this question.