jpayne@69
|
1 #!/bin/bash
|
jpayne@69
|
2
|
jpayne@69
|
3 usage(){
|
jpayne@69
|
4 echo "
|
jpayne@69
|
5 Written by Brian Bushnell
|
jpayne@69
|
6 Last modified August 29, 2017
|
jpayne@69
|
7
|
jpayne@69
|
8 Description: Generates synthetic contaminated partial genomes from clean genomes.
|
jpayne@69
|
9 Output is formatted as (prefix)_bases1_fname1_bases2_fname2_counter_(suffix).
|
jpayne@69
|
10
|
jpayne@69
|
11 Usage: makecontaminatedgenomes.sh in=<file> out=<pattern>
|
jpayne@69
|
12
|
jpayne@69
|
13 I/O parameters:
|
jpayne@69
|
14 in=<file> A file containing one input file path per line.
|
jpayne@69
|
15 out=<pattern> A file name containing a # symbol (or other regex).
|
jpayne@69
|
16 The regex will be replaced by source filenames.
|
jpayne@69
|
17
|
jpayne@69
|
18 Processing Parameters:
|
jpayne@69
|
19 count=1 Number of output files to make.
|
jpayne@69
|
20 seed=-1 RNG seed; negative for a random seed.
|
jpayne@69
|
21 exp1=1 Exponent for genome 1 size fraction.
|
jpayne@69
|
22 exp2=1 Exponent for genome 2 size fraction.
|
jpayne@69
|
23 subrate=0 Rate to add substitutions to new genomes (0-1).
|
jpayne@69
|
24 indelrate=0 Rate to add substitutions to new genomes (0-1).
|
jpayne@69
|
25 regex=# Use this substitution regex for replacement.
|
jpayne@69
|
26 delimiter=_ Use this delimiter in the new file names.
|
jpayne@69
|
27
|
jpayne@69
|
28 Java Parameters:
|
jpayne@69
|
29 -Xmx This will set Java's memory usage, overriding autodetection.
|
jpayne@69
|
30 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
|
jpayne@69
|
31 The max is typically 85% of physical memory.
|
jpayne@69
|
32 -eoom This flag will cause the process to exit if an out-of-memory
|
jpayne@69
|
33 exception occurs. Requires Java 8u92+.
|
jpayne@69
|
34 -da Disable assertions.
|
jpayne@69
|
35
|
jpayne@69
|
36 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
|
jpayne@69
|
37 "
|
jpayne@69
|
38 }
|
jpayne@69
|
39
|
jpayne@69
|
40 #This block allows symlinked shellscripts to correctly set classpath.
|
jpayne@69
|
41 pushd . > /dev/null
|
jpayne@69
|
42 DIR="${BASH_SOURCE[0]}"
|
jpayne@69
|
43 while [ -h "$DIR" ]; do
|
jpayne@69
|
44 cd "$(dirname "$DIR")"
|
jpayne@69
|
45 DIR="$(readlink "$(basename "$DIR")")"
|
jpayne@69
|
46 done
|
jpayne@69
|
47 cd "$(dirname "$DIR")"
|
jpayne@69
|
48 DIR="$(pwd)/"
|
jpayne@69
|
49 popd > /dev/null
|
jpayne@69
|
50
|
jpayne@69
|
51 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
jpayne@69
|
52 CP="$DIR""current/"
|
jpayne@69
|
53
|
jpayne@69
|
54 z="-Xmx4g"
|
jpayne@69
|
55 z2="-Xms4g"
|
jpayne@69
|
56 set=0
|
jpayne@69
|
57
|
jpayne@69
|
58 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
|
jpayne@69
|
59 usage
|
jpayne@69
|
60 exit
|
jpayne@69
|
61 fi
|
jpayne@69
|
62
|
jpayne@69
|
63 calcXmx () {
|
jpayne@69
|
64 source "$DIR""/calcmem.sh"
|
jpayne@69
|
65 setEnvironment
|
jpayne@69
|
66 parseXmx "$@"
|
jpayne@69
|
67 if [[ $set == 1 ]]; then
|
jpayne@69
|
68 return
|
jpayne@69
|
69 fi
|
jpayne@69
|
70 freeRam 4000m 42
|
jpayne@69
|
71 z="-Xmx${RAM}m"
|
jpayne@69
|
72 }
|
jpayne@69
|
73 calcXmx "$@"
|
jpayne@69
|
74
|
jpayne@69
|
75 makecontaminatedgenomes() {
|
jpayne@69
|
76 local CMD="java $EA $EOOM $z -cp $CP jgi.MakeContaminatedGenomes $@"
|
jpayne@69
|
77 echo $CMD >&2
|
jpayne@69
|
78 eval $CMD
|
jpayne@69
|
79 }
|
jpayne@69
|
80
|
jpayne@69
|
81 makecontaminatedgenomes "$@"
|