From ba09efe0f91ce35ddf2ee7b6da6e0bc948f3569e Mon Sep 17 00:00:00 2001
From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu>
Date: Thu, 26 Oct 2017 15:41:00 -0500
Subject: [PATCH] adding cnvkit

---
 alignment/starfusion.sh | 39 ++++++++++++++++++++++++++++++++++-----
 cnvkit.sh               | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 5 deletions(-)
 create mode 100644 cnvkit.sh

diff --git a/alignment/starfusion.sh b/alignment/starfusion.sh
index c2c473a..b2b0acd 100644
--- a/alignment/starfusion.sh
+++ b/alignment/starfusion.sh
@@ -1,11 +1,40 @@
 #!/bin/bash
 #trimgalore.sh
 
-pair_id=$1
-index_path=$2
-fq1=$3
-fq2=$4
+usage() {
+  echo "-h Help documentation for hisat.sh"
+  echo "-r  --Reference Genome: GRCh38 or GRCm38"
+  echo "-a  --FastQ R1"
+  echo "-b  --FastQ R2"
+  echo "-p  --Prefix for output file name"
+  echo "Example: bash hisat.sh -p prefix -r GRCh38 -a SRR1551047_1.fastq.gz  -b SRR1551047_2.fastq.gz"
+  exit 1
+}
+OPTIND=1 # Reset OPTIND
+while getopts :r:a:b:p:h opt
+do
+    case $opt in
+        r) refgeno=$OPTARG;;
+        a) fq1=$OPTARG;;
+        b) fq2=$OPTARG;;
+        p) pair_id=$OPTARG;;
+        h) usage;;
+    esac
+done
+
+shift $(($OPTIND -1))
+
+# Check for mandatory options
+if [[ -z $pair_id ]] || [[ -z $fq1 ]]; then
+    usage
+fi
+
+if [ $refgeno == 'GRCh38' ] || [ $refgeno == 'GRCm38' ]; then
+    index_path=/project/shared/bicf_workflow_ref/${refgeno}/CTAT_lib/
+else
+    usage
+fi
 
 module add python/2.7.x-anaconda star/2.5.2b
-STAR-Fusion --genome_lib_dir ${index_path}/CTAT_lib/ --left_fq ${fq1} --right_fq ${fq2} --output_dir star_fusion &> star_fusion.err
+STAR-Fusion --genome_lib_dir ${index_path} --left_fq ${fq1} --right_fq ${fq2} --output_dir star_fusion &> star_fusion.err
 mv star_fusion/star-fusion.fusion_candidates.final.abridged ${pair_id}.starfusion.txt
diff --git a/cnvkit.sh b/cnvkit.sh
new file mode 100644
index 0000000..8d0a735
--- /dev/null
+++ b/cnvkit.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+#cnvkit.sh
+
+usage() {
+  echo "-h  --Help documentation for markdups.sh"
+  echo "-b  --BAM file"
+  echo "-p  --Prefix for output file name"
+  echo "Example: bash cnvkit.sh -p prefix -b file.bam"
+  exit 1
+}
+OPTIND=1 # Reset OPTIND
+while getopts :b:p:h opt
+do
+    case $opt in
+        b) sbam=$OPTARG;;
+        p) pair_id=$OPTARG;;
+        h) usage;;
+    esac
+done
+
+shift $(($OPTIND -1))
+
+# Check for mandatory options
+if [[ -z $pair_id ]] || [[ -z $sbam ]]; then
+    usage
+fi
+if [[ -z $SLURM_CPUS_ON_NODE ]]
+then
+    SLURM_CPUS_ON_NODE=1
+fi
+
+module load cnvkit/0.9.0
+cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_targets.bed -o ${pair_id}.targetcoverage.cnn
+cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_antitargets.bed -o ${pair_id}.antitargetcoverage.cnn
+cnvkit.py fix ${pair_id}.targetcoverage.cnn ${pair_id}.antitargetcoverage.cnn /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.normals.cnn -o ${pair_id}.cnr
+cnvkit.py segment ${pair_id}.cnr -o ${pair_id}.cns
+cnvkit.py call ${pair_id}.cns -o ${pair_id}.call.cns
+cnvkit.py diagram ${pair_id}.cnr -s ${pair_id}.cns -o ${pair_id}.pdf
-- 
GitLab