Debian Codegraph @

trimcontigs.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified October 1, 2024
7
8 Description: Trims contigs to remove sequence unsupported by read alignment.
9 The coverage range file can be generated by pileup.sh.
10
11 Usage: trimcontigs.sh in=<assembly> ranges=<ranges> out=<trimmed assembly>
12
13 Parameters:
14 in=<file> File containing input assembly.
15 ranges=<file> File generated by pileup with the 'ranges' flag.
16 out=<file> Destination of clean output assembly.
17 outdirty=<file> (outd) Optional dirty output containing removed contigs.
18 gffin=<file> Optional gff file.
19 gffout=<file> Modified gff file.
20 mincov=1 Discard contigs with lower average coverage than this.
21 minlen=1 Discard contigs shorter than this, after trimming.
22 trimmin=0 Trim the first and last X bases of each sequence.
23 trimmax=big Don't trim more than this much on contig ends.
24 trimextra=5 Trim an additional amount when trimming.
25 maxuncovered=3 Don't trim where there are at most this many uncovered bases.
26 break=t Break contigs where uncovered areas are present.
27 breaklist= Optional file to report the list of broken contigs.
28 skippolyn=t Don't break around uncovered poly-Ns (scaffold breaks).
29
30 Java Parameters:
31 -Xmx This will set Java's memory usage, overriding autodetection.
32 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
33 The max is typically 85% of physical memory.
34 -eoom This flag will cause the process to exit if an out-of-memory
35 exception occurs. Requires Java 8u92+.
36 -da Disable assertions.
37
38 Please contact Brian Bushnell at [email protected] if you encounter any problems.
39 "
40 }
41
42 #This block allows symlinked shellscripts to correctly set classpath.
43 pushd . > /dev/null
44 DIR="${BASH_SOURCE[0]}"
45 while [ -h "$DIR" ]; do
46 cd "$(dirname "$DIR")"
47 DIR="$(readlink "$(basename "$DIR")")"
48 done
49 cd "$(dirname "$DIR")"
50 DIR="$(pwd)/"
51 popd > /dev/null
52
53 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
54 CP="$DIR""current/"
55
56 z="-Xmx800m"
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 800m 84
72 z="-Xmx${RAM}m"
73 z2="-Xms${RAM}m"
74 }
75 calcXmx "$@"
76
77 function trimcontigs() {
78 local CMD="java $EA $EOOM $z -cp $CP jgi.TrimContigs $@"
79 echo $CMD >&2
80 eval $CMD
81 }
82
83 trimcontigs "$@"