Skip to content

Commit 787dadb

Browse files
author
Snaedis Kristmundsdottir
committed
Add parameter to specify number of cores to run on.
1 parent d4c1a9c commit 787dadb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

runPerChrom.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/bash
22
set -e
33
set -o pipefail
4-
if [[ "$#" -ne 4 ]]; then
5-
echo "Usage: runPerChrom.sh <bamList> <reference> <chrom> <markersPerJob>"
4+
if [[ "$#" -ne 5 ]]; then
5+
echo "Usage: runPerChrom.sh <bamList> <reference> <chrom> <markersPerJob> <nCores>"
66
exit 1
77
fi
88

99
BAMLIST=$1
1010
REFERENCE=$2
1111
CHROM=$3
1212
MARKERS_PER_JOB=$4
13+
N_CORES=$5
1314
CODE_DIR=`dirname $0`
1415
CURR_DIR=`pwd`
1516

@@ -32,7 +33,7 @@ do
3233
headNum=`expr ${i} \* ${MARKERS_PER_JOB}`
3334
echo "${CODE_DIR}/popSTR computeReadAttributes ${BAMLIST} ${CURR_DIR} <(head -n ${headNum} ${CODE_DIR}/markerInfo/${CHROM}markerInfo | tail -n ${MARKERS_PER_JOB} | cut -d ' ' -f 1-11,14-) 8 135 ${CHROM} ${REFERENCE} ${CODE_DIR}/markerInfo/longRepeats N"
3435
fi
35-
done | parallel
36+
done | parallel -j $N_CORES
3637

3738
#check if pnSlippage has been computed
3839
pnSlippageFile=${CURR_DIR}/pnSlippage
@@ -62,7 +63,7 @@ do
6263
headNum=`expr ${i} \* ${MARKERS_PER_JOB}`
6364
echo "${CODE_DIR}/popSTR msGenotyperDefault -ADCN ${CURR_DIR}/attributes/${CHROM} -PNS pnSlippage -MS markerSlippage${CHROM} -VD ${CURR_DIR}/vcfs -VN ${CHROM} -ML <(cut -d ' ' -f 1,2,3,4,8,12,13 ${CODE_DIR}/markerInfo/${CHROM}markerInfo | head -n ${headNum} | tail -n ${MARKERS_PER_JOB}) -I ${i} -FP 1"
6465
fi
65-
done | parallel
66+
done | parallel -j $N_CORES
6667

6768
#merge vcf files
6869
echo "Merging vcf files"

0 commit comments

Comments
 (0)