Bulk quality filtering with bbduk
1
0
Entering edit mode
7.6 years ago
Felix_1993 • 0

Hi,

I sequenced some gut-samples for microbial communities (16S, paired-end, Illumina MiSeq, fastq).

e.g. Sample1_read1.fq Sample1_read2.fq Sample2_read1.fq Sample2_read2.fq ...etc

I am following the Mothur SOP, however, due to the partially bad read quality, I incorporated a quality filtering step before aligning the reads. Therefore, I use a tool from the BBDuk package

bbduk.sh -Xmx1g in1=Sample1_read1.fq in2=Sample1_read2 out1=Sample1_clean_read1.fq out2=Sample1_clean_read2 qtrim=rl trimq=10

Everything works fine, but now I'd like to run everything in one batch. How can I create a loop so the bbduk.sh goes through all the files in my folder (and always takes read1 and read2 of the same sample)?

Thanks a lot for your help in advance! (And let me know if I missed some vital information)

sequence alignment • 3.9k views
ADD COMMENT
1
Entering edit mode

Use these for inspiration: A: bash loop for alignment RNA-seq data or A: shell script for bowtie/bwa alignment pair end reads

Post if you would like additional help.

ADD REPLY
4
Entering edit mode
7.6 years ago
GenoMax 141k

There can be many variations of this (and each one would get the job done).

for i in `ls -1 *_read1.fq | sed 's/_read1.fq//'`
do
bbduk.sh -Xmx1g in1=$i\_read1.fq in2=$i\_read2 out1=$i\_clean_read1.fq out2=$i\_clean_read2 qtrim=rl trimq=10
done

If you are using a job scheduler on a cluster wrap necessary bits around the bbduk command to submit individual jobs to scheduler.

ADD COMMENT
0
Entering edit mode

Thanks! Worked like a charm!

ADD REPLY
0
Entering edit mode

my files are as such

SRR2753090_1.fastq   SRR2753090_2.fastq

managed to do it..

just for my clarification this is what im using

for i in `ls -1 *_1.fastq | sed 's/_1.fastq//'`
do
bbduk.sh -Xmx1g in1=$i\_1.fastq in2=$i\_2.fastq out1=$i\_clean_1.fastq out2=$i\_clean_2.fastq ref=/src/bbmap/resources/adapters.fa 
done

I hope the loop is correct ..

ADD REPLY

Login before adding your answer.

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