Question: Bulk quality filtering with bbduk
gravatar for Felix_1993
18 months ago by
Felix_19930 wrote:


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 -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 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)

alignment sequence • 598 views
ADD COMMENTlink modified 18 months ago by genomax46k • written 18 months ago by Felix_19930

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 REPLYlink modified 18 months ago • written 18 months ago by genomax46k
gravatar for genomax
18 months ago by
United States
genomax46k wrote:

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 -Xmx1g in1=$i\_read1.fq in2=$i\_read2 out1=$i\_clean_read1.fq out2=$i\_clean_read2 qtrim=rl trimq=10

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

ADD COMMENTlink modified 18 months ago • written 18 months ago by genomax46k

Thanks! Worked like a charm!

ADD REPLYlink written 18 months ago by Felix_19930

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 -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 

I hope the loop is correct ..

ADD REPLYlink modified 19 days ago • written 19 days ago by krushnach80280
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1739 users visited in the last hour