./fastqc -t 12 -c ./Contaminants/contaminant_list.txt -o ${dir}processed ${dir}${file1} ${dir}${file2} > /dev/null
/usr/local/bin/bwa mem -R "@RG\tID:${bamfile}\tSM:${bamfile}\tPL:ILLUMINA\tLB:NexteraXT" -t4 -v2 ${h37}bwai.fasta ${dir}$file1 ${dir}$file2 | /usr/local/bin/samtools import ${h37}sami.fasta.fai - - | /usr/local/bin/samtools sort -@4 -m5G - ${dir}processed/$bamfile
/usr/local/bin/samtools index ${dir}processed/${bamfile}.bam
cd /usr/share/qualimap_v0.7.1; ./qualimap bamqc --java-mem-size=4G -bam ${dir}processed/${bamfile}.bam > /dev/null
/usr/local/bin/samtools rmdup ${dir}processed/${bamfile}.bam ${dir}processed/${bamfile}_nodup.bam; mv ${dir}processed/${bamfile}_nodup.bam ${dir}processed/${bamfile}.bam; /usr/local/bin/samtools index ${dir}processed/${bamfile}.bam
/usr/bin/java -Xmx24g -jar /usr/local/share/GenomeAnalysisTK.jar -T RealignerTargetCreator -R ${h37}sami.fasta -I ${dir}processed/${bamfile}.bam -o ${dir}processed/${bamfile}.bam.intervals -rf BadCigar -nt 12
/usr/bin/java -Xmx4g -jar /usr/local/share/GenomeAnalysisTK.jar -T IndelRealigner -R ${h37}sami.fasta -I ${dir}processed/${bamfile}.bam -targetIntervals ${dir}processed/${bamfile}.bam.intervals -o ${dir}processed/${bamfile}_realigned.bam --defaultBaseQualities 12
/usr/bin/java -Xmx4g -jar /usr/local/share/GenomeAnalysisTK.jar -T BaseRecalibrator -I ${dir}processed/${bamfile}_realigned.bam -R ${h37}sami.fasta --knownSites ${h37}Resi-List-16-12-2013.vcf -o ${dir}processed/${bamfile}_Resilist.grp -nct 8 -rf BadCigar
rm ${dir}processed/${bamfile}.bam ${dir}processed/${bamfile}.bam.bai
/usr/bin/java -Xmx4g -jar /usr/local/share/GenomeAnalysisTK.jar -T PrintReads -R ${h37}sami.fasta -I ${dir}processed/${bamfile}_realigned.bam -BQSR ${dir}processed/${bamfile}_Resilist.grp -o ${dir}processed/${bamfile}.bam -rf BadCigar -nct 8
rm ${dir}processed/${bamfile}_realigned.bam ${dir}processed/${bamfile}_realigned.bai; cp ${dir}processed/${bamfile}.bai ${dir}processed/${bamfile}.bam.bai
/usr/local/bin/samtools mpileup -B -f ${h37}sami.fasta ${dir}processed/${bamfile} > ${dir}processed/${bamfile}.mpileup
/usr/bin/java -Xmx16g -jar /usr/local/share/GenomeAnalysisTK.jar -T UnifiedGenotyper -R ${h37}sami.fasta -I ${dir}processed/${bamfile} -o ${dir}processed/${bamfile}.flt.vcf -glm BOTH -mbq 13 -nct 6 -nt 4 -A BaseCounts -A VariantType -rf BadCigar > /dev/null