Debian Codegraph @

filtersubs.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified August 22, 2024
7
8 Description: Filters a sam file to select only reads with substitution errors
9 for bases with quality scores in a certain interval. Used for manually
10 examining specific reads that may have incorrectly calibrated quality scores.
11
12 Usage: filtersubs.sh in=<file> out=<file> minq=<number> maxq=<number>
13
14 Parameters:
15 in=<file> Input sam or bam file.
16 out=<file> Output file.
17 minq=0 Keep only reads with substitutions of at least this quality.
18 maxq=99 Keep only reads with substitutions of at most this quality.
19 countindels=t Also keep reads with indels in the quality range.
20 minsubs=1 Require at least this many substitutions.
21 minclips=0 Discard reads with more clip operations than this.
22 maxclips=-1 If nonnegative, discard reads with more clip operations.
23 keepperfect=f Also keep error-free reads.
24
25 Please contact Brian Bushnell at [email protected] if you encounter any problems.
26 "
27 }
28
29 #This block allows symlinked shellscripts to correctly set classpath.
30 pushd . > /dev/null
31 DIR="${BASH_SOURCE[0]}"
32 while [ -h "$DIR" ]; do
33 cd "$(dirname "$DIR")"
34 DIR="$(readlink "$(basename "$DIR")")"
35 done
36 cd "$(dirname "$DIR")"
37 DIR="$(pwd)/"
38 popd > /dev/null
39
40 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
41 CP="$DIR""current/"
42
43 z="-Xmx120m"
44 set=0
45
46 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
47 usage
48 exit
49 fi
50
51 calcXmx () {
52 source "$DIR""/calcmem.sh"
53 setEnvironment
54 parseXmx "$@"
55 }
56 calcXmx "$@"
57
58 filtersubs() {
59 local CMD="java $EA $EOOM $z -cp $CP jgi.FilterReadsWithSubs $@"
60 # echo $CMD >&2
61 eval $CMD
62 }
63
64 filtersubs "$@"