| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified January 21, 2020 |
| 7 | |
| 8 | Description: Generates synthetic PacBio reads to mimic the chimeric |
| 9 | inverted repeats from 'triangle reads', aka 'ice cream cones' - |
| 10 | reads missing one adapter. |
| 11 | |
| 12 | Usage: icecreammaker.sh in=<file> out=<file> reads=100k minlen=500 maxlen=5000 |
| 13 | |
| 14 | Standard parameters: |
| 15 | in=<file> A reference genome fasta (optional). |
| 16 | out=<file> Synthetic read output. |
| 17 | idhist=<file> Identity histogram output. |
| 18 | overwrite=f (ow) Set to false to force the program to abort rather than |
| 19 | overwrite an existing file. |
| 20 | ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change compression |
| 21 | level; lower compression is faster. |
| 22 | |
| 23 | Length parameters: |
| 24 | NOTE: "length" parameters dictate subread length (for normal reads). |
| 25 | "Movie" parameters dictate sequence length (with concatenated subreads). |
| 26 | |
| 27 | minlen=500 (minlength) Minimum length of genomic sequence molecules. |
| 28 | maxlen=5000 (maxlength) Maximum length of genomic sequence molecules. |
| 29 | len= (length) Set minlen and maxlen to the same number. |
| 30 | minmovie=500 (minmov) Minimum length of movies. |
| 31 | maxmovie=40k (maxmov) Maximum length of movies. |
| 32 | movie= (mov) Set minmov and maxmov to the same number. |
| 33 | |
| 34 | Ice cream parameters: |
| 35 | missingrate=0 (missing) Fraction of reads missing an adapter. |
| 36 | hiddenrate=0 (hidden) Fraction of adapters not detected. |
| 37 | bothends=f Allow missing or hiddden adapters on both ends. |
| 38 | |
| 39 | Other parameters: |
| 40 | zmws (reads) Number of ZMWs to generate. There are actually |
| 41 | multiple subreads per zmw. |
| 42 | ccs=f Make CCS reads (one read per ZMW, full pass only). |
| 43 | You still need to specify the error rate. |
| 44 | gc=0.6 If a random genome is generated, use this GC fraction. |
| 45 | genomesize=10m If a random genome is generated, make it this big. |
| 46 | irrate=0.0 Add inverted repeats until this fraction of the genome |
| 47 | is inverted repeats. |
| 48 | irminlen=500 Minimum length of inverted repeats. |
| 49 | irmaxlen=5000 Maximum length of inverted repeats |
| 50 | irlen= Set minirlen and maxirlen to the same number. |
| 51 | miner=0.05 (minerrorrate) Minimum error rate. |
| 52 | maxer=0.28 (maxerrorrate) Maximum error rate. |
| 53 | er= (errorrate) Set minerrorrate and maxerrorrate. |
| 54 | NOTE: You can alternatively set minid, maxid, or id. |
| 55 | |
| 56 | |
| 57 | Java Parameters: |
| 58 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 59 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will |
| 60 | specify 200 megs. The max is typically 85% of physical memory. |
| 61 | -eoom This flag will cause the process to exit if an out-of-memory |
| 62 | exception occurs. Requires Java 8u92+. |
| 63 | -da Disable assertions. |
| 64 | |
| 65 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 66 | " |
| 67 | } |
| 68 | |
| 69 | #This block allows symlinked shellscripts to correctly set classpath. |
| 70 | pushd . > /dev/null |
| 71 | DIR="${BASH_SOURCE[0]}" |
| 72 | while [ -h "$DIR" ]; do |
| 73 | cd "$(dirname "$DIR")" |
| 74 | DIR="$(readlink "$(basename "$DIR")")" |
| 75 | done |
| 76 | cd "$(dirname "$DIR")" |
| 77 | DIR="$(pwd)/" |
| 78 | popd > /dev/null |
| 79 | |
| 80 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 81 | CP="$DIR""current/" |
| 82 | |
| 83 | z="-Xmx2g" |
| 84 | z2="-Xms2g" |
| 85 | set=0 |
| 86 | |
| 87 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 88 | usage |
| 89 | exit |
| 90 | fi |
| 91 | |
| 92 | calcXmx () { |
| 93 | source "$DIR""/calcmem.sh" |
| 94 | setEnvironment |
| 95 | parseXmx "$@" |
| 96 | if [[ $set == 1 ]]; then |
| 97 | return |
| 98 | fi |
| 99 | freeRam 2000m 42 |
| 100 | z="-Xmx${RAM}m" |
| 101 | z2="-Xms${RAM}m" |
| 102 | } |
| 103 | calcXmx "$@" |
| 104 | |
| 105 | icecreammaker() { |
| 106 | local CMD="java $EA $EOOM $z -cp $CP icecream.IceCreamMaker $@" |
| 107 | echo $CMD >&2 |
| 108 | eval $CMD |
| 109 | } |
| 110 | |
| 111 | icecreammaker "$@" |