Debian Codegraph @

filterbycoverage.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified May 3, 2016
7
8 Description: Filters an assembly by contig coverage.
9 The coverage stats file can be generated by BBMap or Pileup.
10
11 Usage: filterbycoverage.sh in=<assembly> cov=<coverage stats> out=<filtered assembly> mincov=5
12
13 Parameters:
14 in=<file> File containing input assembly.
15 cov=<file> File containing coverage stats generated by pileup.
16 cov0=<file> Optional file containing coverage stats before normalization.
17 out=<file> Destination of clean output assembly.
18 outd=<file> (outdirty) Destination of dirty output containing only removed contigs.
19 minc=5 (mincov) Discard contigs with lower average coverage.
20 minp=40 (minpercent) Discard contigs with a lower percent covered bases.
21 minr=0 (minreads) Discard contigs with fewer mapped reads.
22 minl=1 (minlength) Discard contigs shorter than this (after trimming).
23 trim=0 (trimends) Trim the first and last X bases of each sequence.
24 ratio=0 If cov0 is set, contigs will not be removed unless the coverage ratio (of cov to cov0) is at least this (0 disables it).
25 ow=t (overwrite) Overwrites files that already exist.
26 app=f (append) Append to files that already exist.
27 zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max).
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 specify 200 megs.
32 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 [email protected] 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="-Xmx800m"
56 set=0
57
58 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
59 usage
60 exit
61 fi
62
63 calcXmx () {
64 source "$DIR""/calcmem.sh"
65 setEnvironment
66 parseXmx "$@"
67 if [[ $set == 1 ]]; then
68 return
69 fi
70 freeRam 800m 84
71 z="-Xmx${RAM}m"
72 z2="-Xms${RAM}m"
73 }
74 calcXmx "$@"
75
76 function filterbycoverage() {
77 local CMD="java $EA $EOOM $z -cp $CP jgi.FilterByCoverage $@"
78 echo $CMD >&2
79 eval $CMD
80 }
81
82 filterbycoverage "$@"