#!/bin/bash raw_reads_dir=$1 output_dir=$2 mkdir $output_dir mkdir trimmed_reads #TRIM READS WITH ALIENTRIMMER for R1 in $(ls $raw_reads_dir/*R1.fastq); do R2=`echo $R1 | sed 's/R1/R2/g'` oR1=`echo $R1 | sed 's/\.fastq/\.at\.fq/g'` oR1=`echo $oR1 | sed 's/fastq\///g'` oR2=`echo $R2 | sed 's/\.fastq/\.at\.fq/g'` oR2=`echo $oR2 | sed 's/fastq\///g'` java -jar soft/AlienTrimmer.jar -if $R1 -ir $R2 -q 20 -c databases/contaminants.fasta -of trimmed_reads/$oR1 -or trimmed_reads/$oR2 done # MERGE READS AND OUTPUT FASTA mkdir fasta for R1 in $(ls trimmed_reads/*R1.at.fq); do R2=`echo $R1 | sed 's/R1/R2/g'` outname=`echo $R1 | sed 's/_R1\.at\.fq/\.fasta/g'` label=`echo $outname | sed 's/trimmed_reads\///g'` outname=`echo $outname | sed 's/trimmed_reads/fasta/g'` label=`echo $label | sed 's/\.fasta//g'` soft/vsearch --fastq_mergepairs $R1 --reverse $R2 --fastaout $outname --label_suffix ";sample=$label;" done # MERGE ALL FASTAS TO 'amplicon.fasta' cat fasta/*.fasta > fasta/amplicon.fasta # REMOVE ' ' FROM EACH READ NAME sed -i 's/ //g' fasta/amplicon.fasta # CREATE OTU # DEDUPLICATION mkdir otu soft/vsearch --derep_fulllength fasta/amplicon.fasta --output otu/fulllength_otu soft/vsearch --derep_prefix fasta/amplicon.fasta --output otu/prefix_otu # REMOVING SINGLETON soft/vsearch --derep_fulllength fasta/amplicon.fasta --output otu/fulllength_min10_otu --minuniquesize 10 soft/vsearch --derep_prefix fasta/amplicon.fasta --output otu/prefix_min10_otu --minuniquesize 10