annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/bbwrap.sh @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 #!/bin/bash
jpayne@69 2
jpayne@69 3 usage(){
jpayne@69 4 echo "
jpayne@69 5 Last modified February 13, 2020
jpayne@69 6
jpayne@69 7 Description: Wrapper for BBMap to allow multiple input and output files for the same reference.
jpayne@69 8
jpayne@69 9 To index: bbwrap.sh ref=<reference fasta>
jpayne@69 10 To map: bbwrap.sh in=<file,file,...> out=<file,file,...>
jpayne@69 11 To map without an index: bbwrap.sh ref=<reference fasta> in=<file,file,...> out=<file,file,...> nodisk
jpayne@69 12 To map pairs and singletons and output them into the same file:
jpayne@69 13 bbwrap.sh in1=read1.fq,singleton.fq in2=read2.fq,null out=mapped.sam append
jpayne@69 14
jpayne@69 15 BBWrap will not work with stdin and stdout, or histogram output.
jpayne@69 16
jpayne@69 17 Other Parameters:
jpayne@69 18
jpayne@69 19 in=<file,file> Input sequences to map.
jpayne@69 20 inlist=<fofn> Alternately, input and output can be a file of filenames,
jpayne@69 21 one line per file, using the flag inlist, outlist, outmlist,
jpayne@69 22 in2list, etc.
jpayne@69 23 mapper=bbmap Select mapper. May be BBMap, BBMapPacBio,
jpayne@69 24 or BBMapPacBioSkimmer.
jpayne@69 25 append=f Append to files rather than overwriting them.
jpayne@69 26 If append is enabled, and there is exactly one output file,
jpayne@69 27 all output will be written to that file.
jpayne@69 28
jpayne@69 29 ***** All BBMap parameters can be used; see bbmap.sh for more details. *****
jpayne@69 30 "
jpayne@69 31 }
jpayne@69 32
jpayne@69 33 #This block allows symlinked shellscripts to correctly set classpath.
jpayne@69 34 pushd . > /dev/null
jpayne@69 35 DIR="${BASH_SOURCE[0]}"
jpayne@69 36 while [ -h "$DIR" ]; do
jpayne@69 37 cd "$(dirname "$DIR")"
jpayne@69 38 DIR="$(readlink "$(basename "$DIR")")"
jpayne@69 39 done
jpayne@69 40 cd "$(dirname "$DIR")"
jpayne@69 41 DIR="$(pwd)/"
jpayne@69 42 popd > /dev/null
jpayne@69 43
jpayne@69 44 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
jpayne@69 45 CP="$DIR""current/"
jpayne@69 46 JNI="-Djava.library.path=""$DIR""jni/"
jpayne@69 47 JNI=""
jpayne@69 48
jpayne@69 49 z="-Xmx1g"
jpayne@69 50 z2="-Xms1g"
jpayne@69 51 set=0
jpayne@69 52
jpayne@69 53 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
jpayne@69 54 usage
jpayne@69 55 exit
jpayne@69 56 fi
jpayne@69 57
jpayne@69 58 calcXmx () {
jpayne@69 59 source "$DIR""/calcmem.sh"
jpayne@69 60 setEnvironment
jpayne@69 61 parseXmx "$@"
jpayne@69 62 if [[ $set == 1 ]]; then
jpayne@69 63 return
jpayne@69 64 fi
jpayne@69 65 freeRam 3200m 84
jpayne@69 66 z="-Xmx${RAM}m"
jpayne@69 67 z2="-Xms${RAM}m"
jpayne@69 68 }
jpayne@69 69 calcXmx "$@"
jpayne@69 70
jpayne@69 71 bbwrap() {
jpayne@69 72 local CMD="java $EA $EOOM $z $z2 $JNI -cp $CP align2.BBWrap build=1 overwrite=true fastareadlen=500 $@"
jpayne@69 73 echo $CMD >&2
jpayne@69 74 eval $CMD
jpayne@69 75 }
jpayne@69 76
jpayne@69 77 bbwrap "$@"