1#!/usr/local/bin/bash 2 3usage(){ 4echo " 5Written by Brian Bushnell 6Last modified April 24, 2019 7 8Description: Reformats a fungal assembly for release. 9Also creates contig and agp files. 10 11Usage: fungalrelease.sh in=<input file> out=<output file> 12 13I/O parameters: 14in=<file> Input scaffolds. 15out=<file> Output scaffolds. 16outc=<file> Output contigs. 17qfin=<file> Optional quality scores input. 18qfout=<file> Optional quality scores output. 19qfoutc=<file> Optional contig quality scores output. 20agp=<file> Output AGP file. 21legend=<file> Output name legend file. 22overwrite=f (ow) Set to false to force the program to abort rather than 23 overwrite an existing file. 24 25Processing parameters: 26fastawrap=60 Wrap length for fasta lines. 27tuc=t Convert sequence to upper case. 28baniupac=t Crash on encountering a non-ACGTN base call. 29mingap=10 Expand all gaps (Ns) to be at least this long. 30mingapin=1 Only expand gaps that are at least this long. 31sortcscaffolds=t Sort scaffolds descending by length. 32sortcontigs=f Sort contigs descending by length. 33renamescaffolds=t Rename scaffolds to 'scaffold_#'. 34scafnum=1 Number of first scaffold. 35renamecontigs=f Rename contigs to 'contig_#' instead of 'scafname_c#'. 36contignum=1 Number of first contig; only used if renamecontigs=t. 37minscaf=1 Only retain scaffolds at least this long. 38mincontig=1 Only retain contigs at least this long. 39 40Java Parameters: 41-Xmx This will set Java's memory usage, overriding autodetection. 42 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. 43 The max is typically 85% of physical memory. 44-eoom This flag will cause the process to exit if an 45 out-of-memory exception occurs. Requires Java 8u92+. 46-da Disable assertions. 47 48Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. 49" 50} 51 52#This block allows symlinked shellscripts to correctly set classpath. 53pushd . > /dev/null 54DIR="${BASH_SOURCE[0]}" 55while [ -h "$DIR" ]; do 56 cd "$(dirname "$DIR")" 57 DIR="$(readlink "$(basename "$DIR")")" 58done 59cd "$(dirname "$DIR")" 60DIR="$(pwd)/" 61popd > /dev/null 62 63#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 64CP="$DIR""current/" 65 66z="-Xmx4g" 67z2="-Xms4g" 68set=0 69 70if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then 71 usage 72 exit 73fi 74 75calcXmx () { 76 source "$DIR""/calcmem.sh" 77 setEnvironment 78 parseXmx "$@" 79 if [[ $set == 1 ]]; then 80 return 81 fi 82} 83calcXmx "$@" 84 85fungalrelease() { 86 local CMD="java $EOOM $EA $EOOM $z $z2 -cp $CP jgi.FungalRelease $@" 87 echo $CMD >&2 88 eval $CMD 89} 90 91fungalrelease "$@" 92