Debian Codegraph @

filterbysequence.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified November 22, 2023
7
8 Description: Filters sequences by exact sequence matches.
9 This can also handle inexact matches but is extremely slow in that mode.
10
11 Usage: filterbysequence.sh in=<file> out=<file> ref=<file> include=<t/f>
12
13 I/O Parameters:
14 in= Primary input. 'in2' will specify a second file.
15 out= Primary out. 'out2' will specify a second file.
16 ref= A reference file or comma-delimited list of files.
17 literal= A literal sequence or comma-delimited list of sequences.
18 ow=t (overwrite) Overwrites files that already exist.
19
20 Processing Parameters:
21 include=f Set to 'true' to include the filtered sequences rather
22 than excluding them.
23 rcomp=t Match reverse complements as well.
24 case=f (casesensitive) Require matching case.
25 storebases=t (sb) Store ref bases. Requires more memory. If false,
26 case-sensitive matching cannot be done, and the matching
27 will be probabilistic based on 128-bit hashcodes.
28 threads=auto (t) Specify the number of worker threads.
29 subs=0 Maximum number of substitutions allowed.
30 mf=0.0 (mismatchfraction) Maximum fraction of bases that can
31 mismatch. The actual number allowed is the max of subs
32 and mf*min(query.length, ref.length).
33 lengthdif=0 Maximum allowed length difference between query and ref.
34
35 Java Parameters:
36 -Xmx This will set Java's memory usage, overriding autodetection.
37 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
38 The max is typically 85% of physical memory.
39 -eoom This flag will cause the process to exit if an out-of-memory
40 exception occurs. Requires Java 8u92+.
41 -da Disable assertions.
42
43 Please contact Brian Bushnell at [email protected] if you encounter any problems.
44 "
45 }
46
47 #This block allows symlinked shellscripts to correctly set classpath.
48 pushd . > /dev/null
49 DIR="${BASH_SOURCE[0]}"
50 while [ -h "$DIR" ]; do
51 cd "$(dirname "$DIR")"
52 DIR="$(readlink "$(basename "$DIR")")"
53 done
54 cd "$(dirname "$DIR")"
55 DIR="$(pwd)/"
56 popd > /dev/null
57
58 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
59 CP="$DIR""current/"
60
61 z="-Xmx800m"
62 set=0
63
64 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
65 usage
66 exit
67 fi
68
69 calcXmx () {
70 source "$DIR""/calcmem.sh"
71 setEnvironment
72 parseXmx "$@"
73 if [[ $set == 1 ]]; then
74 return
75 fi
76 freeRam 800m 84
77 z="-Xmx${RAM}m"
78 z2="-Xms${RAM}m"
79 }
80 calcXmx "$@"
81
82 function filterbysequence() {
83 local CMD="java $EA $EOOM $z -cp $CP jgi.FilterBySequence $@"
84 echo $CMD >&2
85 eval $CMD
86 }
87
88 filterbysequence "$@"