From cd1382aad49e2b55ddc1eb5c43ee0d46b7e50f4a Mon Sep 17 00:00:00 2001
From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu>
Date: Fri, 18 Sep 2020 10:05:29 -0500
Subject: [PATCH] update module load; platypus update sampleid

---
 alignment/bam2tdf.sh              | 8 +++++---
 alignment/hisat_genotype.sh       | 8 +++++---
 alignment/indexbams.sh            | 8 ++++++--
 genect_rnaseq/statanal.sh         | 6 ++++--
 {variants => obsolete}/itdseek.sh | 0
 {variants => obsolete}/pindel.sh  | 0
 variants/germline_vc.sh           | 6 ++++++
 variants/norm_annot.sh            | 7 ++++---
 variants/svcalling.sh             | 1 +
 9 files changed, 31 insertions(+), 13 deletions(-)
 rename {variants => obsolete}/itdseek.sh (100%)
 rename {variants => obsolete}/pindel.sh (100%)

diff --git a/alignment/bam2tdf.sh b/alignment/bam2tdf.sh
index e6299d5..1834c77 100755
--- a/alignment/bam2tdf.sh
+++ b/alignment/bam2tdf.sh
@@ -30,8 +30,10 @@ then
 fi
 
 baseDir="`dirname \"$0\"`"
-
-source /etc/profile.d/modules.sh
-module load igvtools/2.3.71 samtools/1.6
+if [[ -z $isdocker ]]
+then
+    source /etc/profile.d/modules.sh
+    module load igvtools/2.3.71 samtools/1.6
+exit
 samtools index  -@ $NPROC $bam
 igvtools count -z 5 $bam ${pair_id}.tdf ${index_path}/igv/human.genome
diff --git a/alignment/hisat_genotype.sh b/alignment/hisat_genotype.sh
index 4ee37c6..97e3f71 100755
--- a/alignment/hisat_genotype.sh
+++ b/alignment/hisat_genotype.sh
@@ -35,9 +35,11 @@ then
     NPROC=`nproc`
 fi
 
-source /etc/profile.d/modules.sh
-module load hisat-genotype/1.0.1
-
+if [[ -z $isdocker ]]
+then
+    source /etc/profile.d/modules.sh
+    module load hisat-genotype/1.0.1
+fi
 diff $fq1 $fq2 > difffile
 
 if [ -s difffile ]
diff --git a/alignment/indexbams.sh b/alignment/indexbams.sh
index 2af125d..ecdab13 100755
--- a/alignment/indexbams.sh
+++ b/alignment/indexbams.sh
@@ -26,8 +26,12 @@ fi
 
 baseDir="`dirname \"$0\"`"
 
-source /etc/profile.d/modules.sh
-module load samtools/1.6
+if [[ -z $isdocker ]]
+then
+    source /etc/profile.d/modules.sh
+    module load samtools/1.6
+fi
+
 for i in *.bam; do
     samtools index -@ $NPROC ${i}
 done 
diff --git a/genect_rnaseq/statanal.sh b/genect_rnaseq/statanal.sh
index 23efcf1..cdf3b1c 100644
--- a/genect_rnaseq/statanal.sh
+++ b/genect_rnaseq/statanal.sh
@@ -25,8 +25,10 @@ if [[ -z $NPROC ]]
 then
     NPROC=`nproc`
 fi
-source /etc/profile.d/modules.sh
-
+if [[ -z $isdocker ]]
+then
+    source /etc/profile.d/modules.sh
+fi
 perl $baseDir/concat_cts.pl -o ./ *.cts
 perl $baseDir/concat_fpkm.pl -o ./ *.fpkm.txt
 perl $baseDir/concat_ctsum.pl -o ./ *.cts.summary
diff --git a/variants/itdseek.sh b/obsolete/itdseek.sh
similarity index 100%
rename from variants/itdseek.sh
rename to obsolete/itdseek.sh
diff --git a/variants/pindel.sh b/obsolete/pindel.sh
similarity index 100%
rename from variants/pindel.sh
rename to obsolete/pindel.sh
diff --git a/variants/germline_vc.sh b/variants/germline_vc.sh
index a4ff47e..334d7d6 100755
--- a/variants/germline_vc.sh
+++ b/variants/germline_vc.sh
@@ -107,6 +107,12 @@ then
     fi
     bamlist=`join_by , *.bam`
     Platypus.py callVariants --minMapQual=0 --minReads=3 --mergeClusteredVariants=1 --nCPU=$NPROC --bamFiles=${bamlist} --refFile=${reffa} --output=platypus.vcf
+    for i in *.bam
+    do
+	prefix="${i%.bam}"
+	sid=`samtools view -H ${i} |grep '^@RG' |perl -pe 's/\t/\n/g' |grep ID |cut -f 2 -d ':'`
+	perl -pi -e "s/$prefix/$sid/g" platypus.vcf
+    done
     vcf-sort platypus.vcf |vcf-annotate -n --fill-type -n |bgzip > platypus.vcf.gz
     tabix platypus.vcf.gz
     bcftools norm -c s -f ${reffa} -w 10 -O z -o ${pair_id}.platypus.vcf.gz platypus.vcf.gz
diff --git a/variants/norm_annot.sh b/variants/norm_annot.sh
index 776c306..445ceab 100755
--- a/variants/norm_annot.sh
+++ b/variants/norm_annot.sh
@@ -24,9 +24,10 @@ function join_by { local IFS="$1"; shift; echo "$*"; }
 shift $(($OPTIND -1))
 baseDir="`dirname \"$0\"`"
 
-source /etc/profile.d/modules.sh
-module load bedtools/2.26.0 samtools/gcc/1.8 bcftools/gcc/1.8 snpeff/4.3q 
-
+if [[ -z $isdocker ]]
+   source /etc/profile.d/modules.sh
+   module load bedtools/2.26.0 samtools/gcc/1.8 bcftools/gcc/1.8 snpeff/4.3q 
+fi
 if [[ -a "${index_path}/genome.fa" ]]
 then
     reffa="${index_path}/genome.fa"
diff --git a/variants/svcalling.sh b/variants/svcalling.sh
index f422e93..1ad18f6 100755
--- a/variants/svcalling.sh
+++ b/variants/svcalling.sh
@@ -190,6 +190,7 @@ then
 elif [[ $method == 'itdseek' ]]
 then
     stexe=`which samtools`
+    echo $stexe
     samtools view -@ $NPROC -L ${itdbed} ${sbam} | itdseek.pl --refseq ${reffa} --samtools ${stexe} --bam ${sbam} | vcf-sort | bedtools intersect -header -b ${itdbed} -a stdin | java -Xmx30g -jar $SNPEFF_HOME/SnpSift.jar filter "( LEN < 10000 )" | bgzip > ${pair_id}.itdseek.vcf.gz
     
     tabix ${pair_id}.itdseek.vcf.gz
-- 
GitLab