From ac7a88b410cb6701e016f409a9f184b46da44553 Mon Sep 17 00:00:00 2001 From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu> Date: Tue, 11 Aug 2020 21:39:51 -0500 Subject: [PATCH] adding if is docker --- alignment/bamqc.sh | 8 ++++++-- alignment/dnaseqalign.sh | 9 ++++++--- alignment/markdups.sh | 29 ++++++++++++++++++----------- alignment/starfusion.sh | 7 +++++-- alignment/virusalign.sh | 7 +++++-- genect_rnaseq/geneabundance.sh | 7 +++++-- preproc_fastq/trimgalore.sh | 9 ++++++--- variants/checkmate.sh | 26 +++++++++++--------------- variants/cnvkit.sh | 9 +++++---- variants/gatkrunner.sh | 7 +++++-- variants/msisensor.sh | 1 - variants/uni_norm_annot.sh | 9 +++++---- variants/union.sh | 10 ++++++---- 13 files changed, 83 insertions(+), 55 deletions(-) diff --git a/alignment/bamqc.sh b/alignment/bamqc.sh index acd91a8..cf2e3d6 100755 --- a/alignment/bamqc.sh +++ b/alignment/bamqc.sh @@ -64,8 +64,12 @@ then parseopt="$parseopt -r $index_path" fi tmpdir=`pwd` -source /etc/profile.d/modules.sh -module load samtools/gcc/1.10 fastqc/0.11.8 bedtools/2.29.0 picard/2.10.3 + +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load samtools/gcc/1.10 fastqc/0.11.8 bedtools/2.29.0 picard/2.10.3 +fi samtools flagstat ${sbam} > ${pair_id}.flagstat.txt fastqc -f bam ${sbam} diff --git a/alignment/dnaseqalign.sh b/alignment/dnaseqalign.sh index 14b2dc1..084b844 100755 --- a/alignment/dnaseqalign.sh +++ b/alignment/dnaseqalign.sh @@ -51,13 +51,16 @@ else testexe='/usr/local/bin' fi -source /etc/profile.d/modules.sh -module load python/2.7.x-anaconda bwakit/0.7.15 samtools/gcc/1.8 picard/2.10.3 +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load python/2.7.x-anaconda bwakit/0.7.15 samtools/gcc/1.8 picard/2.10.3 bwa/intel/0.7.17 +fi baseDir="`dirname \"$0\"`" diff $fq1 $fq2 > difffile -module load bwa/intel/0.7.17 + if [ -s difffile ] diff --git a/alignment/markdups.sh b/alignment/markdups.sh index dbe1b8e..15fec48 100755 --- a/alignment/markdups.sh +++ b/alignment/markdups.sh @@ -48,17 +48,18 @@ fi baseDir="`dirname \"$0\"`" -source /etc/profile.d/modules.sh -module load picard/2.10.3 - -if [ $algo == 'sambamba' ] +if [[ -z $isdocker ]] then - module load speedseq/20160506 - sambamba markdup -t $NPROC ${sbam} ${pair_id}.dedup.bam - touch ${pair_id}.dedup.stat.txt -elif [ $algo == 'samtools' ] + source /etc/profile.d/modules.sh + module load picard/2.10.3 +fi + +if [ $algo == 'samtools' ] then - module load samtools/gcc/1.8 + if [[ -z $isdocker ]] + then + module load samtools/gcc/1.8 + fi samtools markdup -s --output-fmt BAM -@ $NPROC sort.bam ${pair_id}.dedup.bam touch ${pair_id}.dedup.stat.txt elif [ $algo == 'picard' ] @@ -69,7 +70,10 @@ then java -XX:ParallelGCThreads=$NPROC -Djava.io.tmpdir=./ -Xmx16g -jar $PICARD/picard.jar MarkDuplicates BARCODE_TAG=RX I=${sbam} O=${pair_id}.dedup.bam M=${pair_id}.dedup.stat.txt elif [ $algo == 'fgbio_umi' ] then - module load fgbio bwakit/0.7.15 bwa/intel/0.7.17 samtools/gcc/1.8 + if [[ -z $isdocker ]] + then + module load fgbio bwakit/0.7.15 bwa/intel/0.7.17 samtools/gcc/1.8 + fi samtools index -@ $NPROC ${sbam} fgbio --tmp-dir ./ GroupReadsByUmi -s identity -i ${sbam} -o group.bam --family-size-histogram ${pair_id}.umihist.txt -e 0 -m 0 fgbio --tmp-dir ./ CallMolecularConsensusReads -i group.bam -p consensus -M 1 -o ${pair_id}.consensus.bam -S ':none:' @@ -90,5 +94,8 @@ then else cp ${sbam} ${pair_id}.dedup.bam fi -module load samtools/gcc/1.8 +if [[ -z $isdocker ]] +then + module load samtools/gcc/1.8 +fi samtools index -@ $NPROC ${pair_id}.dedup.bam diff --git a/alignment/starfusion.sh b/alignment/starfusion.sh index 583dce5..9bc7050 100755 --- a/alignment/starfusion.sh +++ b/alignment/starfusion.sh @@ -38,9 +38,12 @@ then fi baseDir="`dirname \"$0\"`" -source /etc/profile.d/modules.sh -module add python/2.7.x-anaconda star/2.5.2b bedtools/2.26.0 +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module add python/2.7.x-anaconda star/2.5.2b bedtools/2.26.0 +fi if [[ -n $method ]] && [[ $method == 'trinity' ]] then diff --git a/alignment/virusalign.sh b/alignment/virusalign.sh index 6343ef9..7840d20 100755 --- a/alignment/virusalign.sh +++ b/alignment/virusalign.sh @@ -34,8 +34,11 @@ then fi reffa=${ref}/idt_virus_reference.fa -source /etc/profile.d/modules.sh -module load bwa/intel/0.7.17 picard/2.10.3 samtools/1.6 +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load bwa/intel/0.7.17 picard/2.10.3 samtools/1.6 +fi baseDir="`dirname \"$0\"`" samtools view -@ 8 -b -u -F 2 ${bam} |samtools sort -n - >unmapped.bam diff --git a/genect_rnaseq/geneabundance.sh b/genect_rnaseq/geneabundance.sh index e70954a..bbaf11f 100644 --- a/genect_rnaseq/geneabundance.sh +++ b/genect_rnaseq/geneabundance.sh @@ -40,8 +40,11 @@ if [[ $NPROC > 64 ]] then NPROC=64 fi -source /etc/profile.d/modules.sh -module load subread/1.6.1 +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load subread/1.6.1 +fi baseDir="`dirname \"$0\"`" export PATH=/project/shared/bicf_workflow_ref/seqprg/bin:$PATH diff --git a/preproc_fastq/trimgalore.sh b/preproc_fastq/trimgalore.sh index e198d3c..aadd30e 100644 --- a/preproc_fastq/trimgalore.sh +++ b/preproc_fastq/trimgalore.sh @@ -55,9 +55,12 @@ if [[ $numfq == 1 ]] then copts="$copts --paired" fi - -source /etc/profile.d/modules.sh -module load trimgalore/0.6.4 cutadapt/2.5 + +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load trimgalore/0.6.4 cutadapt/2.5 +fi trim_galore $copts ${fqs} files=`find ./ -name "*_val_1.fq.gz"` diff --git a/variants/checkmate.sh b/variants/checkmate.sh index 6bdb0cf..855b168 100755 --- a/variants/checkmate.sh +++ b/variants/checkmate.sh @@ -28,17 +28,23 @@ function join_by { local IFS="$1"; shift; echo "$*"; } shift $(($OPTIND -1)) baseDir="`dirname \"$0\"`" -# Check for mandatory options -source /etc/profile.d/modules.sh -export PATH=/project/shared/bicf_workflow_ref/seqprg/bin:/usr/local/bin/:$PATH +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load samtools/gcc/1.8 bcftools/gcc/1.8 + ncm=/project/shared/bicf_workflow_ref/seqprg/NGSCheckMate/ncm.py +fi -module load samtools/gcc/1.8 bcftools/gcc/1.8 +export PATH=/project/shared/bicf_workflow_ref/seqprg/bin:/usr/local/bin/:$PATH +if [[ -f /usr/local/bin/ncm.py ]] +then + ncm=/usr/local/bin/ncm.py +fi if [[ -z $capture ]] then capture="${index_path}/NGSCheckMate.bed" fi - if [[ -f "${index_path}/genome.fa" ]] then reffa="${index_path}/genome.fa" @@ -50,15 +56,5 @@ for i in *.bam; do bcftools mpileup -A -d 1000000 -C50 -Ou --gvcf 0 -f ${reffa} -T ${capture} $i | bcftools call -m --gvcf 0 -Ov | bcftools convert --gvcf2vcf -f ${reffa} -Ov -o ${prefix}.vcf done -if [[ -f /project/shared/bicf_workflow_ref/seqprg/NGSCheckMate/ncm.py ]] -then - ncm=/project/shared/bicf_workflow_ref/seqprg/NGSCheckMate/ncm.py -elif [[ -f /usr/local/bin/ncm.py ]] -then - ncm=/usr/local/bin/ncm.py -else - echo "ncm missing" -fi - python $ncm -V -d ./ -bed $capture -O ./ -N ${pair_id} perl $baseDir/sequenceqc_somatic.pl -i ${pair_id}_all.txt -o ${pair_id}.sequence.stats.txt diff --git a/variants/cnvkit.sh b/variants/cnvkit.sh index bb9ea27..dc37f05 100755 --- a/variants/cnvkit.sh +++ b/variants/cnvkit.sh @@ -63,8 +63,11 @@ capture="$paneldir/targetpanel.bed" targets="$paneldir/cnvkit." normals="$paneldir/pon.cnn" -source /etc/profile.d/modules.sh -module load cnvkit/0.9.5 bedtools/2.26.0 samtools/gcc/1.8 bcftools/gcc/1.8 java/oracle/jdk1.8.0_171 snpeff/4.3q +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load cnvkit/0.9.5 bedtools/2.26.0 samtools/gcc/1.8 bcftools/gcc/1.8 java/oracle/jdk1.8.0_171 snpeff/4.3q +fi if [[ -f "${paneldir}/pon.downsample.cnn" ]] then @@ -100,8 +103,6 @@ fi if [[ $numsnps -gt 100 ]] then - #samtools index ${sbam} - #java -jar /cm/shared/apps/gatk/3.8/target/package/GenomeAnalysisTK.jar -T UnifiedGenotyper -R ${reffa} --output_mode EMIT_ALL_SITES -L ${index_path}/IDT_snps.hg38.bed -o common_variants.vcf -glm BOTH -dcov 10000 -I ${sbam} bcftools mpileup -A -d 1000000 -C50 -Ou --gvcf 0 -f ${reffa} -a INFO/AD,INFO/ADF,INFO/ADR,FORMAT/DP,FORMAT/SP,FORMAT/AD,FORMAT/ADF,FORMAT/ADR -T ${index_path}/IDT_snps.hg38.bed ${sbam} | bcftools call -m --gvcf 0 -Ov | bcftools convert --gvcf2vcf -f ${reffa} -Ov -o common_variants.vcf $baseDir/formatVcfCNV.pl cnvkit_common common_variants.vcf echo -e "CHROM\tPOS\tAO\tRO\tDP\tMAF" > ${pair_id}.ballelefreq.txt diff --git a/variants/gatkrunner.sh b/variants/gatkrunner.sh index 01533a2..26509fd 100755 --- a/variants/gatkrunner.sh +++ b/variants/gatkrunner.sh @@ -49,8 +49,11 @@ then usage fi -source /etc/profile.d/modules.sh -module load gatk/4.1.4.0 samtools/gcc/1.8 +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load gatk/4.1.4.0 samtools/gcc/1.8 +fi which samtools samtools index -@ $NPROC ${sbam} diff --git a/variants/msisensor.sh b/variants/msisensor.sh index 1ab0aba..1d27dc8 100755 --- a/variants/msisensor.sh +++ b/variants/msisensor.sh @@ -30,7 +30,6 @@ if [[ -z $sbam ]] || [[ -z $index_path ]]; then usage fi -source /etc/profile.d/modules.sh export PATH=/project/shared/bicf_workflow_ref/seqprg/bin:$PATH bedopt='' diff --git a/variants/uni_norm_annot.sh b/variants/uni_norm_annot.sh index e47e045..502fa0e 100755 --- a/variants/uni_norm_annot.sh +++ b/variants/uni_norm_annot.sh @@ -37,10 +37,11 @@ if [[ -z $snpeffgeno ]] then snpeffgeno='GRCh38.86' fi - -source /etc/profile.d/modules.sh -module load bedtools/2.26.0 samtools/1.6 bcftools/1.6 snpeff/4.3q - +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load bedtools/2.26.0 samtools/1.6 bcftools/1.6 snpeff/4.3q +fi export PATH=/project/shared/bicf_workflow_ref/seqprg/bin:$PATH perl $baseDir\/uniform_vcf_gt.pl $pair_id $vcf diff --git a/variants/union.sh b/variants/union.sh index a02cd2c..1b58f5f 100755 --- a/variants/union.sh +++ b/variants/union.sh @@ -26,11 +26,13 @@ echo $pair_id $index_path $dir if [[ -z $dir ]] then -dir='.' + dir='.' +fi +if [[ -z $isdocker ]] +then + source /etc/profile.d/modules.sh + module load bedtools/2.26.0 samtools/1.6 bcftools/1.6 snpeff/4.3q fi - -source /etc/profile.d/modules.sh -module load bedtools/2.26.0 samtools/1.6 bcftools/1.6 snpeff/4.3q HS=${dir}/*.hotspot.vcf.gz list1=`ls ${dir}/*vcf.gz|grep -v hotspot` -- GitLab