Question: Bulk quality filtering with bbduk
0
gravatar for Felix_1993
2.2 years ago by
Felix_19930
Felix_19930 wrote:

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)

alignment sequence • 1.1k views
ADD COMMENTlink modified 2.2 years ago by genomax59k • written 2.2 years ago by Felix_19930
1

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 2.2 years ago • written 2.2 years ago by genomax59k
4
gravatar for genomax
2.2 years ago by
genomax59k
United States
genomax59k 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
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 COMMENTlink modified 2.2 years ago • written 2.2 years ago by genomax59k

Thanks! Worked like a charm!

ADD REPLYlink written 2.2 years 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
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 REPLYlink modified 8 months ago • written 8 months ago by krushnach80440
Please log in to add an answer.

Help
Access

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