jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Written by Brian Bushnell jpayne@69: Last modified September 4, 2019 jpayne@69: jpayne@69: Description: Makes a representative set of taxa from all-to-all identity jpayne@69: comparison. Input should be in 3+ column TSV format (first 3 are required): jpayne@69: (query, ref, ANI, qsize, rsize, qbases, rbases) jpayne@69: ...as produced by CompareSketch with format=3 and usetaxidname. jpayne@69: Additional columns are allowed and will be ignored. jpayne@69: jpayne@69: Usage: representative.sh in= out= jpayne@69: jpayne@69: Parameters: jpayne@69: overwrite=f (ow) Set to false to force the program to abort rather than jpayne@69: overwrite an existing file. jpayne@69: threshold=0 Ignore edges under threshold value. This also affects the jpayne@69: choice of centroids; a high threshold gives more weight to jpayne@69: higher-value edges. jpayne@69: minratio=0 Ignores edges with a ratio below this value. jpayne@69: invertratio=f Invert the ratio when greater than 1. jpayne@69: printheader=t Print a header line in the output. jpayne@69: printsize=t Print the size of retained nodes. jpayne@69: printclusters=t Print the nodes subsumed by each retained node. jpayne@69: minsize=0 Ignore nodes under this size (in unique kmers). jpayne@69: maxsize=0 If positive, ignore nodes over this size (unique kmers). jpayne@69: minbases=0 Ignore nodes under this size (in total bases). jpayne@69: maxbases=0 If positive, ignore nodes over this size (total bases). jpayne@69: jpayne@69: Taxonomy parameters: jpayne@69: level= Taxonomic level, such as phylum. Filtering will operate on jpayne@69: sequences within the same taxonomic level as specified ids. jpayne@69: If not set, only matches to a node or its descendants will jpayne@69: be considered. jpayne@69: ids= Comma-delimited list of NCBI numeric IDs. Can also be a jpayne@69: file with one taxID per line. jpayne@69: names= Alternately, a list of names (such as 'Homo sapiens'). jpayne@69: Note that spaces need special handling. jpayne@69: include=f 'f' will discard filtered sequences, 't' will keep them. jpayne@69: tree= Specify a TaxTree file like tree.taxtree.gz. jpayne@69: On Genepool, use 'auto'. jpayne@69: jpayne@69: Java Parameters: jpayne@69: -Xmx This will set Java's memory usage, overriding autodetection. jpayne@69: -Xmx20g will jpayne@69: specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. jpayne@69: The max is typically around 85% of physical memory. jpayne@69: -eoom This flag will cause the process to exit if an out-of-memory jpayne@69: exception occurs. Requires Java 8u92+. jpayne@69: -da Disable assertions. jpayne@69: jpayne@69: Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. jpayne@69: " jpayne@69: } jpayne@69: jpayne@69: #This block allows symlinked shellscripts to correctly set classpath. jpayne@69: pushd . > /dev/null jpayne@69: DIR="${BASH_SOURCE[0]}" jpayne@69: while [ -h "$DIR" ]; do jpayne@69: cd "$(dirname "$DIR")" jpayne@69: DIR="$(readlink "$(basename "$DIR")")" jpayne@69: done jpayne@69: cd "$(dirname "$DIR")" jpayne@69: DIR="$(pwd)/" jpayne@69: popd > /dev/null jpayne@69: jpayne@69: #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" jpayne@69: CP="$DIR""current/" jpayne@69: jpayne@69: z="-Xmx4g" jpayne@69: z2="-Xms4g" jpayne@69: set=0 jpayne@69: jpayne@69: if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then jpayne@69: usage jpayne@69: exit jpayne@69: fi jpayne@69: jpayne@69: calcXmx () { jpayne@69: source "$DIR""/calcmem.sh" jpayne@69: setEnvironment jpayne@69: parseXmx "$@" jpayne@69: if [[ $set == 1 ]]; then jpayne@69: return jpayne@69: fi jpayne@69: freeRam 4000m 84 jpayne@69: z="-Xmx${RAM}m" jpayne@69: z2="-Xms${RAM}m" jpayne@69: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: a_sample_mt() { jpayne@69: local CMD="java $EA $EOOM $z -cp $CP jgi.RepresentativeSet $@" jpayne@69: echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: a_sample_mt "$@"