diff --git a/alignment/bamqc.sh b/alignment/bamqc.sh index 029a921d4f13e70325c598c61321f1dcbe270eab..91ddb959070c920c788b1b8a0d1bcfabb836d07c 100644 --- a/alignment/bamqc.sh +++ b/alignment/bamqc.sh @@ -8,11 +8,12 @@ usage() { echo "-n --NucType" echo "-p --Prefix for output file name" echo "-c --Capture Bedfile" + echo "-d --RemoveDuplicates 1=yes, 0=no default=no" echo "Example: bash bamqc.sh -p prefix -r /project/shared/bicf_workflow_ref/human/GRCh38 -b SRR1551047.bam -n dna -c target.bed" exit 1 } OPTIND=1 # Reset OPTIND -while getopts :r:b:c:n:p:h opt +while getopts :r:b:c:n:p:d:h opt do case $opt in r) index_path=$OPTARG;; @@ -20,6 +21,7 @@ do c) bed=$OPTARG;; n) nuctype=$OPTARG;; p) pair_id=$OPTARG;; + d) dedup=$OPTARG;; h) usage;; esac done @@ -42,6 +44,12 @@ then SLURM_CPUS_ON_NODE=1 fi +if [[ $dedup == 1 ]] +then + mv $sbam ori.bam + samtools view -@ $SLURM_CPUS_ON_NODE -F 1024 -b -o ${sbam} ori.bam +fi + if [[ $nuctype == 'dna' ]]; then module load bedtools/2.26.0 picard/2.10.3 samtools view -@ $SLURM_CPUS_ON_NODE -b -L ${bed} -o ${pair_id}.ontarget.bam ${sbam}