comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/fixgaps.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 September 11, 2019
7
8 Description: Uses paired read insert sizes to estimate the correct
9 length of scaffold gaps, and resizes incorrectly-sized gaps.
10
11 Usage: fixgaps.sh in=mapped.sam ref=scaffolds.fa out=fixed.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; may be fasta or fastq.
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 Consider any consecutive streak of Ns at least this long to
22 be a scaffold break. Gaps will not be resized to less than
23 this.
24 border=0.4 Ignore the outermost (border*readlen) of an insert (read pair)
25 when incrementing coverage. A higher value is more accurate
26 but requires more coverage and/or longer inserts. Range: 0-1.
27 mindepth=10 Minimum spanning read pairs to correct a gap.
28
29 Java Parameters:
30 -Xmx This will set Java's memory usage, overriding autodetection.
31 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will
32 specify 200 megs. The max is typically 85% of physical memory.
33 -eoom This flag will cause the process to exit if an out-of-memory
34 exception occurs. Requires Java 8u92+.
35 -da Disable assertions.
36
37 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
38 "
39 }
40
41 #This block allows symlinked shellscripts to correctly set classpath.
42 pushd . > /dev/null
43 DIR="${BASH_SOURCE[0]}"
44 while [ -h "$DIR" ]; do
45 cd "$(dirname "$DIR")"
46 DIR="$(readlink "$(basename "$DIR")")"
47 done
48 cd "$(dirname "$DIR")"
49 DIR="$(pwd)/"
50 popd > /dev/null
51
52 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
53 CP="$DIR""current/"
54
55 z="-Xmx4g"
56 z2="-Xms4g"
57 set=0
58
59 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
60 usage
61 exit
62 fi
63
64 calcXmx () {
65 source "$DIR""/calcmem.sh"
66 setEnvironment
67 parseXmx "$@"
68 if [[ $set == 1 ]]; then
69 return
70 fi
71 freeRam 4000m 84
72 z="-Xmx${RAM}m"
73 z2="-Xms${RAM}m"
74 }
75 calcXmx "$@"
76
77 fixgaps() {
78 local CMD="java $EA $EOOM $z -cp $CP consensus.FixScaffoldGaps $@"
79 echo $CMD >&2
80 eval $CMD
81 }
82
83 fixgaps "$@"