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

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified August 6, 2019
7
8 Description: Creates a mutant version of a genome.
9
10 Usage: mutate.sh in=<input file> out=<output file> id=<identity>
11
12 I/O parameters:
13 in=<file> Input genome.
14 out=<file> Output mutant genome.
15 vcf=<file> Output VCF file showing variations added.
16 overwrite=f (ow) Set to false to force the program to abort rather than
17 overwrite an existing file.
18 ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change compression
19 level; lower compression is faster.
20
21 Processing parameters:
22 subrate=0 Substitution rate, 0 to 1.
23 indelrate=0 Indel rate, 0 to 1.
24 maxindel=1 Max indel length.
25 indelspacing=10 Minimum distance between subsequent indels.
26 id=1 Target identity, 0 to 1; 1 means 100%.
27 If this is used it will override subrate and indelrate;
28 99% of the mutations will be substitutions, and 1% indels.
29 fraction=1 Genome fraction, 0 to 1; 1 means 100%. A lower fraction
30 will randomly select that fraction on a per-sequence basis,
31 possibly incurring one chimeric junction per sequence.
32 Not compatible with VCF output.
33 period=-1 If positive, place exactly one mutation every X bases.
34 prefix= Set this flag to rename the new contigs with this prefix
35 and a number.
36 amino=f Treat the input as amino acid sequence.
37 ploidy=1 Set the ploidy. ploidy>1 allows heterozygous mutations.
38 This will create one copy of each input sequence per ploidy.
39 hetrate=0.5 If polyploid, fraction of mutations that are heterozygous.
40 nohomopolymers=f If true, prevent indels in homopolymers that lead to
41 ambiguous variant calls. For example, inserting A between
42 AC or deleting T from TTTT. This is mainly for grading
43 purposes. It does not fully solve the problem, but greatly
44 improves concordance (reducing disagreements by 70%).
45
46 Java Parameters:
47 -Xmx This will set Java's memory usage, overriding autodetection.
48 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will
49 specify 200 megs. The max is typically 85% of physical memory.
50 -eoom This flag will cause the process to exit if an out-of-memory
51 exception occurs. Requires Java 8u92+.
52 -da Disable assertions.
53
54 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
55 "
56 }
57
58 #This block allows symlinked shellscripts to correctly set classpath.
59 pushd . > /dev/null
60 DIR="${BASH_SOURCE[0]}"
61 while [ -h "$DIR" ]; do
62 cd "$(dirname "$DIR")"
63 DIR="$(readlink "$(basename "$DIR")")"
64 done
65 cd "$(dirname "$DIR")"
66 DIR="$(pwd)/"
67 popd > /dev/null
68
69 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
70 CP="$DIR""current/"
71
72 z="-Xmx4g"
73 z2="-Xms4g"
74 set=0
75
76 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
77 usage
78 exit
79 fi
80
81 calcXmx () {
82 source "$DIR""/calcmem.sh"
83 setEnvironment
84 parseXmx "$@"
85 if [[ $set == 1 ]]; then
86 return
87 fi
88 freeRam 4000m 84
89 z="-Xmx${RAM}m"
90 z2="-Xms${RAM}m"
91 }
92 calcXmx "$@"
93
94 mutate() {
95 local CMD="java $EA $EOOM $z $z2 -cp $CP jgi.MutateGenome $@"
96 echo $CMD >&2
97 eval $CMD
98 }
99
100 mutate "$@"