diff --git a/CHANGELOG.md b/CHANGELOG.md index aac514667058a584d1fba7e70cd1a61a4ebd7540..d03d30fc3cd531f9153ca498f842f72c67f52c0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## v1.1.0 - 2019-10-15 +* Update hicpro2higlass with `-p` parameter * Support 'N' base motif in restriction/ligation sites * Support multiple restriction enzymes/ligattion sites (comma separated) ([#31](https://github.com/nf-core/hic/issues/31)) * Add --saveInteractionBAM option diff --git a/bin/hicpro2higlass.sh b/bin/hicpro2higlass.sh index 5cc09b773e9dc016fd0bf1d95a023e3b4bb29054..ff11aeeb538bbfb06acead2d22646c93d8a567bf 100755 --- a/bin/hicpro2higlass.sh +++ b/bin/hicpro2higlass.sh @@ -103,6 +103,7 @@ function help { echo " -i|--input INPUT : allValidPairs or matrix file generated by HiC-Pro" echo " -r|--res RESOLUTION : .matrix file resolution or maximum resolution to reach from the .allValidPairs input file" echo " -c|--chrom CHROMSIZE : chromosome size file" + echo " -p|--proc NB_CPU : number of CPUs for cooler" echo " [-n|--norm] : run cooler matrix balancing algorithm" echo " [-o|--out] : output path. Default is current path" echo " [-t|--temp] TEMP : path to tmp folder. Default is current path" @@ -125,6 +126,7 @@ for arg in "$@"; do "--bed") set -- "$@" "-b" ;; "--res") set -- "$@" "-r" ;; "--chrom") set -- "$@" "-c" ;; + "--proc") set -- "$@" "-p" ;; "--out") set -- "$@" "-o" ;; "--temp") set -- "$@" "-t" ;; "--norm") set -- "$@" "-n" ;; @@ -136,18 +138,20 @@ done INPUT_HICPRO="" INPUT_BED="" NORMALIZE=0 +NPROC=1 CHROMSIZES_FILE="" RES=10000 OUT="./" TEMP="./" -while getopts ":i:b:c:r:o:t:nh" OPT +while getopts ":i:b:c:p:r:o:t:nh" OPT do case $OPT in i) INPUT_HICPRO=$OPTARG;; b) INPUT_BED=$OPTARG;; n) NORMALIZE=1;; c) CHROMSIZES_FILE=$OPTARG;; + p) NPROC=$OPTARG;; r) RES=$OPTARG;; o) OUT=$OPTARG;; t) TEMP=$OPTARG;; @@ -223,9 +227,9 @@ if [[ $DATATYPE == "MATRIX" ]]; then echo -e "\nZoomify .cool file ..." if [[ $NORMALIZE == 1 ]]; then - cooler zoomify --balance $tmp_dir/$out + cooler zoomify --nproc ${NPROC} --balance $tmp_dir/$out else - cooler zoomify --no-balance $tmp_dir/$out + cooler zoomify --nproc ${NPROC} $tmp_dir/$out fi out=$(basename $INPUT_HICPRO | sed -e 's/.mat.*/.mcool/') @@ -233,19 +237,19 @@ elif [[ $DATATYPE == "VALID" ]]; then out=$(basename $INPUT_HICPRO | sed -e 's/.allValidPairs.*/.cool/') awk '{OFS="\t";print $2,$3,$4,$5,$6,$7,1}' $INPUT_HICPRO | sed -e 's/+/1/g' -e 's/-/16/g' > $tmp_dir/contacts.txt - cooler csort --nproc 2 -c1 1 -p1 2 -s1 3 -c2 4 -p2 5 -s2 6 \ + cooler csort --nproc ${NPROC} -c1 1 -p1 2 -s1 3 -c2 4 -p2 5 -s2 6 \ -o $tmp_dir/contacts.sorted.txt.gz \ $tmp_dir/contacts.txt \ $CHROMSIZES_FILE cooler makebins $CHROMSIZES_FILE $RES > $tmp_dir/bins.bed - cooler cload pairix $tmp_dir/bins.bed $tmp_dir/contacts.sorted.txt.gz $tmp_dir/$out + cooler cload pairix --nproc ${NPROC} $tmp_dir/bins.bed $tmp_dir/contacts.sorted.txt.gz $tmp_dir/$out echo -e "\nZoomify .cool file ..." if [[ $NORMALIZE == 1 ]]; then - cooler zoomify --balance $tmp_dir/$out + cooler zoomify --nproc ${NPROC} --balance $tmp_dir/$out else - cooler zoomify --no-balance $tmp_dir/$out + cooler zoomify --nproc ${NPROC} $tmp_dir/$out fi out=$(basename $INPUT_HICPRO | sed -e 's/.allValidPairs.*/.mcool/') fi diff --git a/conf/base.config b/conf/base.config index 28b467901007da4efaf10945d3c2000644f69d90..706ca6c5fa0bdd5d24e3d009e1770f1cb07c82f2 100644 --- a/conf/base.config +++ b/conf/base.config @@ -66,6 +66,11 @@ process { memory = { check_max( 10.GB * task.attempt, 'memory' ) } time = { check_max( 5.h * task.attempt, 'time' ) } } + withName:generate_cool { + cpus = check_max( 2, 'cpus' ) } + memory = { check_max( 16.GB * task.attempt, 'memory' ) } + time = { check_max( 4.h * task.attempt, 'time' ) } + } } params {