Splitting Odd and Even Reads from FastQ to Seperate Output Files
1
0
Entering edit mode
5.7 years ago
landrjos ▴ 20

Hi All,

I have a bioinformatics question. I would like to partition a fastq file into 2 separate output files with odd reads (lines 1-4, 9-12, etc....) into a odd output file (file1) and even reads (lines 5-8, 13-16) into a even output file (file2). Does anyone know a Split command which would do this? I am a newbie to terminal commands this complex.

Best,

Jos

sequence • 1.8k views
ADD COMMENT
0
Entering edit mode
5.7 years ago
5heikki 11k
awk '{if(NR<5){print $0 > "file1.fq"}else{print $0 > "file2.fq";if(NR>7){NR=0}}}' input.fq
ADD COMMENT

Login before adding your answer.

Traffic: 3254 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