| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified March 25, 2025 |
| 7 | |
| 8 | Description: Makes vectors for QuickBin network training. |
| 9 | |
| 10 | Usage: makequickbinvector.sh in=contigs.fa out=vector.txt cov=cov.txt lines=1m |
| 11 | |
| 12 | Parameters: |
| 13 | in=<file> Assembly input; only required parameter. |
| 14 | cov=<file> Cov file generated by Quickbin from sam files. |
| 15 | out=<file> Output file. |
| 16 | lines=1m Lines to output. |
| 17 | rate=0.5 Fraction of vectors with positive results. |
| 18 | mincontig=200 Do not load contigs shorter than this. |
| 19 | minlen=0 Do not print comparisons where either contig is shorter |
| 20 | than this. |
| 21 | maxlen=2B Do not print comparisons where both contigs are longer |
| 22 | than this. |
| 23 | maxgcdif=1.0 Max allowed GC difference for output. |
| 24 | maxkmerdif=1.0 Max allowed TNF cosine difference for output. |
| 25 | maxdepthratio=1000.0 Max allowed depth ratio for output. |
| 26 | |
| 27 | Java Parameters: |
| 28 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 29 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will |
| 30 | specify 200 megs. The max is typically 85% of physical memory. |
| 31 | -eoom This flag will cause the process to exit if an out-of-memory |
| 32 | exception occurs. Requires Java 8u92+. |
| 33 | -da Disable assertions. |
| 34 | |
| 35 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 36 | " |
| 37 | } |
| 38 | |
| 39 | #This block allows symlinked shellscripts to correctly set classpath. |
| 40 | pushd . > /dev/null |
| 41 | DIR="${BASH_SOURCE[0]}" |
| 42 | while [ -h "$DIR" ]; do |
| 43 | cd "$(dirname "$DIR")" |
| 44 | DIR="$(readlink "$(basename "$DIR")")" |
| 45 | done |
| 46 | cd "$(dirname "$DIR")" |
| 47 | DIR="$(pwd)/" |
| 48 | popd > /dev/null |
| 49 | |
| 50 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 51 | CP="$DIR""current/" |
| 52 | |
| 53 | z="-Xmx4g" |
| 54 | z2="-Xms4g" |
| 55 | set=0 |
| 56 | |
| 57 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 58 | usage |
| 59 | exit |
| 60 | fi |
| 61 | |
| 62 | calcXmx () { |
| 63 | source "$DIR""/calcmem.sh" |
| 64 | setEnvironment |
| 65 | parseXmx "$@" |
| 66 | if [[ $set == 1 ]]; then |
| 67 | return |
| 68 | fi |
| 69 | freeRam 4000m 42 |
| 70 | z="-Xmx${RAM}m" |
| 71 | z2="-Xms${RAM}m" |
| 72 | } |
| 73 | calcXmx "$@" |
| 74 | |
| 75 | vector() { |
| 76 | local CMD="java $EA $EOOM $z -cp $CP bin.AllToAllVectorMaker $@" |
| 77 | echo $CMD >&2 |
| 78 | eval $CMD |
| 79 | } |
| 80 | |
| 81 | vector "$@" |