jpayne@69: #!/bin/bash jpayne@69: jpayne@69: usage(){ jpayne@69: echo " jpayne@69: Last modified February 13, 2020 jpayne@69: jpayne@69: Description: Wrapper for BBMap to allow multiple input and output files for the same reference. jpayne@69: jpayne@69: To index: bbwrap.sh ref= jpayne@69: To map: bbwrap.sh in= out= jpayne@69: To map without an index: bbwrap.sh ref= in= out= nodisk jpayne@69: To map pairs and singletons and output them into the same file: jpayne@69: bbwrap.sh in1=read1.fq,singleton.fq in2=read2.fq,null out=mapped.sam append jpayne@69: jpayne@69: BBWrap will not work with stdin and stdout, or histogram output. jpayne@69: jpayne@69: Other Parameters: jpayne@69: jpayne@69: in= Input sequences to map. jpayne@69: inlist= Alternately, input and output can be a file of filenames, jpayne@69: one line per file, using the flag inlist, outlist, outmlist, jpayne@69: in2list, etc. jpayne@69: mapper=bbmap Select mapper. May be BBMap, BBMapPacBio, jpayne@69: or BBMapPacBioSkimmer. jpayne@69: append=f Append to files rather than overwriting them. jpayne@69: If append is enabled, and there is exactly one output file, jpayne@69: all output will be written to that file. jpayne@69: jpayne@69: ***** All BBMap parameters can be used; see bbmap.sh for more details. ***** 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: JNI="-Djava.library.path=""$DIR""jni/" jpayne@69: JNI="" jpayne@69: jpayne@69: z="-Xmx1g" jpayne@69: z2="-Xms1g" 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 3200m 84 jpayne@69: z="-Xmx${RAM}m" jpayne@69: z2="-Xms${RAM}m" jpayne@69: } jpayne@69: calcXmx "$@" jpayne@69: jpayne@69: bbwrap() { jpayne@69: local CMD="java $EA $EOOM $z $z2 $JNI -cp $CP align2.BBWrap build=1 overwrite=true fastareadlen=500 $@" jpayne@69: echo $CMD >&2 jpayne@69: eval $CMD jpayne@69: } jpayne@69: jpayne@69: bbwrap "$@"