File: compare-time.sh

package info (click to toggle)
mosdepth 0.3.11%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,960 kB
  • sloc: sh: 268; python: 132; makefile: 28
file content (59 lines) | stat: -rw-r--r-- 2,164 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
set -euo pipefail
export PATH=/scratch/ucgd/lustre/work/u6000771/Projects/src/samtools/:/scratch/ucgd/lustre/work/u6000771/Projects/src/bedtools2/bin/:$PATH
export LD_LIBRARY_PATH=/scratch/ucgd/lustre/work/u6000771/Projects/src/htslib/

export bam=/scratch/ucgd/lustre/work/u6000771/Data/NA12878.mem.bam
export bam=/scratch/ucgd/lustre/work/u6000771/Data/mosdepth/ERR1395576.30X.bam
#export bam=/scratch/ucgd/lustre/work/u6000771/Data/mosdepth/small.bam
export cram=/scratch/ucgd/lustre/work/u6000771/Data/mosdepth/ERR1395576.30X.cram
export fasta=/scratch/ucgd/lustre/work/u6000771/bcbio/genomes/Hsapiens/g1k_v37_decoy/seq/g1k_v37_decoy.fa
#export cram=/scratch/ucgd/lustre/work/u6000771/Data/NA12878.mem.cram
#export bam=test.bam

export TIMEFORMAT='%lU'

dotime() {
	# returns the max memory use in MiB and time in seconds for the given command.
	# usage:
	# sets _MEM, _TIME env vars.
	# so use can also be:
    # $ dotime "sleep 2" > /dev/null
	# $ echo  $_MEM $_TIME
	set -euo pipefail
	export cmd="$1"
	T="$(date +%s)"
	res="$(/usr/bin/time -v bash -c "$cmd 2>xx.stderr" 2>&1 1>/dev/null)" # | grep Maximum | awk '{ print $NF}' )"
	_MEM=$(echo "$res" | grep Maximum | awk '{ print $NF }')
	export _MEM=$(echo "scale=2; $_MEM / 1024" | bc -l)
	export _USER_TIME="$(echo "$res" | grep "User time" | awk '{ print $NF }')"
	export _WALL_TIME="$(echo "$res" | grep "Elapsed " | awk '{ print $NF }')"
}

report_time() {
	dotime "$1"
	echo -e "$1|$_USER_TIME|$_WALL_TIME|$_MEM"
}



report_time "sleep 1"
report_time "mosdepth -t 2 $cram"
report_time "mosdepth -t 1 $cram"
report_time "mosdepth -t 0 $cram"

report_time "mosdepth -t 2 $bam"
report_time "mosdepth -t 1 $bam"
report_time "mosdepth -t 0 $bam"

report_time "mosdepth -t 2 --by 500 $bam"
report_time "mosdepth -t 1 --by 500 $bam"
report_time "mosdepth -t 0 --by 500 $bam"

report_time "mosdepth -t 2 --by 500 $cram"
report_time "mosdepth -t 1 --by 500 $cram"
report_time "mosdepth -t 0 --by 500 $cram"
report_time	"sambamba_v0.6.6 depth base --fix-mate-overlaps $bam"

report_time "samtools depth -d 100000 $bam"
report_time "samtools depth -d 100000 $cram"
report_time "bedtools genomecov -ibam $bam"