| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified April 17, 2024 |
| 7 | |
| 8 | Description: This is a version of Pileup designed to process multiple files |
| 9 | concurrently. If you only have one input file just use regular Pileup. |
| 10 | Other than those mentioned here, the flags are the same as in pileup.sh. |
| 11 | |
| 12 | Usage: pileup2.sh in=<file,file,file> out=<file> |
| 13 | Alternate: pileup2.sh *.sam out=<file> |
| 14 | |
| 15 | Parameters: |
| 16 | in=<file,file> The input sam/bam files. Omit the 'in=' if a wildcard |
| 17 | is used. |
| 18 | streams=-1 If positive, use at most this many concurrent streams. |
| 19 | Default is half the number of logical processors. Note |
| 20 | that each stream uses multiple threads. |
| 21 | atomic=false Use atomic arrays instead of locks. |
| 22 | prealloc=false Preallocate coverage arrays instead of creating them |
| 23 | as needed. |
| 24 | |
| 25 | Java Parameters: |
| 26 | -Xmx This will set Java's memory usage, overriding |
| 27 | autodetection. -Xmx20g will |
| 28 | specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. |
| 29 | The max is typically 85% of physical memory. |
| 30 | -eoom This flag will cause the process to exit if an out-of-memory |
| 31 | exception occurs. Requires Java 8u92+. |
| 32 | -da Disable assertions. |
| 33 | |
| 34 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 35 | " |
| 36 | } |
| 37 | |
| 38 | #This block allows symlinked shellscripts to correctly set classpath. |
| 39 | pushd . > /dev/null |
| 40 | DIR="${BASH_SOURCE[0]}" |
| 41 | while [ -h "$DIR" ]; do |
| 42 | cd "$(dirname "$DIR")" |
| 43 | DIR="$(readlink "$(basename "$DIR")")" |
| 44 | done |
| 45 | cd "$(dirname "$DIR")" |
| 46 | DIR="$(pwd)/" |
| 47 | popd > /dev/null |
| 48 | |
| 49 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 50 | CP="$DIR""current/" |
| 51 | |
| 52 | z="-Xmx1g" |
| 53 | z2="-Xms1g" |
| 54 | set=0 |
| 55 | |
| 56 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 57 | usage |
| 58 | exit |
| 59 | fi |
| 60 | |
| 61 | calcXmx () { |
| 62 | source "$DIR""/calcmem.sh" |
| 63 | setEnvironment |
| 64 | parseXmx "$@" |
| 65 | if [[ $set == 1 ]]; then |
| 66 | return |
| 67 | fi |
| 68 | freeRam 3200m 84 |
| 69 | z="-Xmx${RAM}m" |
| 70 | z2="-Xms${RAM}m" |
| 71 | } |
| 72 | calcXmx "$@" |
| 73 | |
| 74 | pileup() { |
| 75 | local CMD="java $EA $EOOM $z -cp $CP jgi.CoveragePileupMT $@" |
| 76 | echo $CMD >&2 |
| 77 | eval $CMD |
| 78 | } |
| 79 | |
| 80 | pileup "$@" |