Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/applyvariants.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 January 26, 2021 | |
7 | |
8 Description: Mutates a reference by applying a set of variants. | |
9 When 2 variants overlap, the one with the higher allele count is used. | |
10 | |
11 Usage: applyvariants.sh in=<input file> vcf=<vcf file> out=<output file> | |
12 | |
13 Standard parameters: | |
14 in=<file> Reference fasta. | |
15 vcf=<file> Variants. | |
16 basecov=<file> Optional per-base coverage from BBMap or Pileup. | |
17 out=<file> Output fasta. | |
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 Processing parameters: | |
24 mincov=0 If positive and depth is below this, change ref to N. | |
25 Requires a coverage file. | |
26 maxindel=-1 If positive, ignore indels longer than this. | |
27 noframeshifts=f Ignore indels that are not a multiple of 3 in length. | |
28 | |
29 Renaming: | |
30 name= Optionally rename sequences to this. | |
31 addnumbers=f Add _1 and so forth to ensure sequence names are unique. | |
32 prefix=t Use the name as a prefix to the old name, instead of replacing | |
33 the old name. | |
34 delimiter=_ Symbol to place between parts of the new name. | |
35 For space or tab, use the literal word. | |
36 | |
37 Java Parameters: | |
38 -Xmx This will set Java's memory usage, overriding autodetection. | |
39 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will | |
40 specify 200 megs. The max is typically 85% of physical memory. | |
41 -eoom This flag will cause the process to exit if an out-of-memory | |
42 exception occurs. Requires Java 8u92+. | |
43 -da Disable assertions. | |
44 | |
45 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. | |
46 " | |
47 } | |
48 | |
49 #This block allows symlinked shellscripts to correctly set classpath. | |
50 pushd . > /dev/null | |
51 DIR="${BASH_SOURCE[0]}" | |
52 while [ -h "$DIR" ]; do | |
53 cd "$(dirname "$DIR")" | |
54 DIR="$(readlink "$(basename "$DIR")")" | |
55 done | |
56 cd "$(dirname "$DIR")" | |
57 DIR="$(pwd)/" | |
58 popd > /dev/null | |
59 | |
60 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" | |
61 CP="$DIR""current/" | |
62 | |
63 z="-Xmx4g" | |
64 z2="-Xms4g" | |
65 set=0 | |
66 | |
67 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then | |
68 usage | |
69 exit | |
70 fi | |
71 | |
72 calcXmx () { | |
73 source "$DIR""/calcmem.sh" | |
74 setEnvironment | |
75 parseXmx "$@" | |
76 if [[ $set == 1 ]]; then | |
77 return | |
78 fi | |
79 freeRam 4000m 84 | |
80 z="-Xmx${RAM}m" | |
81 z2="-Xms${RAM}m" | |
82 } | |
83 calcXmx "$@" | |
84 | |
85 applyvariants() { | |
86 local CMD="java $EA $EOOM $z -cp $CP var2.ApplyVariants $@" | |
87 echo $CMD >&2 | |
88 eval $CMD | |
89 } | |
90 | |
91 applyvariants "$@" |