1#!/usr/local/bin/bash 2 3usage(){ 4echo " 5Written by Brian Bushnell 6Last modified January 22, 2020 7 8Description: Splits a file of various rRNAs into one file per type 9(16S, 18S, 5S, 23s). 10 11Usage: splitribo.sh in=<file,file> out=<pattern> 12 13Standard parameters: 14in=<file> Input file. 15out=<pattern> Output file pattern, such as out_#.fa. The # symbol is 16 required and will be substituted by the type name, such as 17 16S, to make out_16S.fa, for example. 18overwrite=f (ow) Set to false to force the program to abort rather than 19 overwrite an existing file. 20ziplevel=9 (zl) Set to 1 (lowest) through 9 (max) to change compression 21 level; lower compression is faster. 22 23types=16S,18S,5S,23S,m16S,m18S,p16S 24 Align to these sequences. Fewer types is faster. m16S 25 and m18S are mitochondrial; p16S is plastid (chloroplast). 26 27Processing parameters: 28minid=0.59 Ignore alignments with identity lower than this to a 29 consensus sequences. 30refineid=0.70 Refine score by aligning to clade-specific consensus if 31 the best alignment to a universal consensus is below this. 32 33Java Parameters: 34-Xmx This will set Java's memory usage, overriding autodetection. 35 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will 36 specify 200 megs. The max is typically 85% of physical memory. 37-eoom This flag will cause the process to exit if an out-of-memory 38 exception occurs. Requires Java 8u92+. 39-da Disable assertions. 40 41Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. 42" 43} 44 45#This block allows symlinked shellscripts to correctly set classpath. 46pushd . > /dev/null 47DIR="${BASH_SOURCE[0]}" 48while [ -h "$DIR" ]; do 49 cd "$(dirname "$DIR")" 50 DIR="$(readlink "$(basename "$DIR")")" 51done 52cd "$(dirname "$DIR")" 53DIR="$(pwd)/" 54popd > /dev/null 55 56#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 57CP="$DIR""current/" 58 59z="-Xmx4g" 60z2="-Xms4g" 61set=0 62 63if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then 64 usage 65 exit 66fi 67 68calcXmx () { 69 source "$DIR""/calcmem.sh" 70 setEnvironment 71 parseXmx "$@" 72 if [[ $set == 1 ]]; then 73 return 74 fi 75 freeRam 4000m 42 76 z="-Xmx${RAM}m" 77 z2="-Xms${RAM}m" 78} 79calcXmx "$@" 80 81mergeribo() { 82 local CMD="java $EA $EOOM $z -cp $CP prok.SplitRibo $@" 83 echo $CMD >&2 84 eval $CMD 85} 86 87mergeribo "$@" 88