Question: Bulk quality filtering with bbduk
0
gravatar for Felix_1993
21 months 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 • 760 views
ADD COMMENTlink modified 21 months ago by genomax51k • written 21 months 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 21 months ago • written 21 months ago by genomax51k
4
gravatar for genomax
21 months ago by
genomax51k
United States
genomax51k 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 21 months ago • written 21 months ago by genomax51k

Thanks! Worked like a charm!

ADD REPLYlink written 21 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
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 3 months ago • written 3 months ago by krushnach80320
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: 1422 users visited in the last hour