Debian Codegraph @

kmerfilterset.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified October 24, 2019
7
8 Description: Generates a set of kmers such that every input sequence will
9 contain at least one kmer in the set. This is a greedy algorithm which
10 retains the top X most common kmers each pass, and removes the sequences
11 matching those kmers, so subsequent passes are faster.
12
13 This will not generate an optimally small set but the output will be
14 quite small. The file size may be further decreased with kcompress.sh.
15
16 Usage: kmerfilterset.sh in=<input file> out=<output file> k=<integer>
17
18 File parameters:
19 in=<file> Primary input.
20 out=<file> Primary output.
21 temp=<file> Temporary file pattern (optional). Must contain # symbol.
22 initial=<file> Initial kmer set (optional). This can be used to accelerate
23 the process.
24
25 Processing parameters:
26 k=31 Kmer length.
27 rcomp=t Consider forward and reverse-complement kmers identical.
28 minkpp=1 (minkmersperpass) Retain at least this many kmers per pass.
29 Higher is faster but results in a larger set.
30 maxkpp=2 (maxkmersperpass) Retain at most this many kmers per pass;
31 0 means unlimited.
32 mincount=1 Ignore kmers seen fewer than this many times in this pass.
33 maxpasses=3000 Don't run more than this many passes.
34 maxns=BIG Ignore sequences with more than this many Ns.
35 minlen=0 Ignore sequences shorter than this.
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 [email protected] 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="-Xmx1000m"
64 z2="-Xms1000m"
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 }
77 calcXmx "$@"
78
79 kmerlimit() {
80 local CMD="java $EA $EOOM $z -cp $CP jgi.KmerFilterSetMaker $@"
81 echo $CMD >&2
82 eval $CMD
83 }
84
85 kmerlimit "$@"