Debian Codegraph @

filterlines.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified July 6, 2015
7
8 Description: Filters lines by exact match or substring.
9
10 Usage: filterlines.sh in=<file> out=<file> names=<file> include=<t/f>
11
12 Parameters:
13 include=f Set to 'true' to include the filtered names rather than excluding them.
14 prefix=f Allow matching of only the line's prefix (all characters up to first whitespace).
15 substring=f Allow one name to be a substring of the other, rather than a full match.
16 f: No substring matching.
17 t: Bidirectional substring matching.
18 line: Allow input lines to be substrings of names in list.
19 name: Allow names in list to be substrings of input lines.
20 case=t (casesensitive) Match case also.
21 ow=t (overwrite) Overwrites files that already exist.
22 app=f (append) Append to files that already exist.
23 zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max).
24 names= A list of strings or files, comma-delimited. Files must have one name per line.
25
26 Java Parameters:
27 -Xmx This will set Java's memory usage, overriding autodetection.
28 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
29 The max is typically 85% of physical memory.
30 -eoom This flag will cause the process to exit if an out-of-memory
31 exception occurs. Requires Java 8u92+.
32 -da Disable assertions.
33
34 To read from stdin, set 'in=stdin'. The format should be specified with an extension, like 'in=stdin.fq.gz'
35 To write to stdout, set 'out=stdout'. The format should be specified with an extension, like 'out=stdout.fasta'
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 filterlines() {
77 local CMD="java $EA $EOOM $z -cp $CP driver.FilterLines $@"
78 echo $CMD >&2
79 eval $CMD
80 }
81
82 filterlines "$@"