| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified September 13, 2019 |
| 7 | |
| 8 | Description: Uses mapped paired reads to generate scaffolds from contigs. |
| 9 | Designed for use with ordinary paired-end Illumina libraries. |
| 10 | |
| 11 | Usage: lilypad.sh in=mapped.sam ref=contigs.fa out=scaffolds.fa |
| 12 | |
| 13 | Standard parameters: |
| 14 | in=<file> Reads mapped to the reference; should be sam or bam. |
| 15 | ref=<file> Reference; may be fasta or fastq. |
| 16 | out=<file> Modified reference; should be fasta. |
| 17 | overwrite=f (ow) Set to false to force the program to abort rather than |
| 18 | overwrite an existing file. |
| 19 | |
| 20 | Processing parameters: |
| 21 | gap=10 Pad gaps with a minimum of this many Ns. |
| 22 | mindepth=4 Minimum spanning read pairs to join contigs. |
| 23 | maxinsert=3000 Maximum allowed insert size for proper pairs. |
| 24 | mincontig=200 Ignore contigs under this length if there is a |
| 25 | longer alternative. |
| 26 | minwr=0.8 (minWeightRatio) Minimum fraction of outgoing edges |
| 27 | pointing to the same contig. Lower values will increase |
| 28 | continuity at a risk of misassemblies. |
| 29 | minsr=0.8 (minStrandRatio) Minimum fraction of outgoing edges |
| 30 | indicating the same orientation. Lower values will increase |
| 31 | continuity at a possible risk of inversions. |
| 32 | passes=8 More passes may increase continuity. |
| 33 | samestrandpairs=f Read pairs map to the same strand. Currently untested. |
| 34 | |
| 35 | Java Parameters: |
| 36 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 37 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will |
| 38 | specify 200 megs. The max is typically 85% of physical memory. |
| 39 | -eoom This flag will cause the process to exit if an out-of-memory |
| 40 | exception occurs. Requires Java 8u92+. |
| 41 | -da Disable assertions. |
| 42 | |
| 43 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 44 | " |
| 45 | } |
| 46 | |
| 47 | #This block allows symlinked shellscripts to correctly set classpath. |
| 48 | pushd . > /dev/null |
| 49 | DIR="${BASH_SOURCE[0]}" |
| 50 | while [ -h "$DIR" ]; do |
| 51 | cd "$(dirname "$DIR")" |
| 52 | DIR="$(readlink "$(basename "$DIR")")" |
| 53 | done |
| 54 | cd "$(dirname "$DIR")" |
| 55 | DIR="$(pwd)/" |
| 56 | popd > /dev/null |
| 57 | |
| 58 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 59 | CP="$DIR""current/" |
| 60 | |
| 61 | z="-Xmx4g" |
| 62 | z2="-Xms4g" |
| 63 | set=0 |
| 64 | |
| 65 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 66 | usage |
| 67 | exit |
| 68 | fi |
| 69 | |
| 70 | calcXmx () { |
| 71 | source "$DIR""/calcmem.sh" |
| 72 | setEnvironment |
| 73 | parseXmx "$@" |
| 74 | if [[ $set == 1 ]]; then |
| 75 | return |
| 76 | fi |
| 77 | freeRam 4000m 84 |
| 78 | z="-Xmx${RAM}m" |
| 79 | z2="-Xms${RAM}m" |
| 80 | } |
| 81 | calcXmx "$@" |
| 82 | |
| 83 | lilypad() { |
| 84 | local CMD="java $EA $EOOM $z -cp $CP consensus.Lilypad $@" |
| 85 | echo $CMD >&2 |
| 86 | eval $CMD |
| 87 | } |
| 88 | |
| 89 | lilypad "$@" |