Debian Codegraph @

dedupebymapping.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified April 4, 2020
7
8 Description: Deduplicates mapped reads based on pair mapping coordinates.
9
10 Usage: dedupebymapping.sh in=<file> out=<file>
11
12 Parameters:
13 in=<file> The 'in=' flag is needed if the input file is not the
14 first parameter. 'in=stdin' will pipe from standard in.
15 out=<file> The 'out=' flag is needed if the output file is not the
16 second parameter. 'out=stdout' will pipe to standard out.
17 overwrite=t (ow) Set to false to force the program to abort rather
18 than overwrite an existing file.
19 ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change
20 compression level; lower compression is faster.
21 keepunmapped=t (ku) Keep unmapped reads. This refers to unmapped
22 single-ended reads or pairs with both unmapped.
23 keepsingletons=t (ks) Keep all pairs in which only one read mapped. If
24 false, duplicate singletons will be discarded.
25 ignorepairorder=f (ipo) If true, consider reverse-complementary pairs
26 as duplicates.
27
28 Java Parameters:
29 -Xmx This will set Java's memory usage, overriding autodetection.
30 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
31 The max is typically 85% of physical memory.
32 -eoom This flag will cause the process to exit if an
33 out-of-memory exception occurs. Requires Java 8u92+.
34 -da Disable assertions.
35
36 Please contact Brian Bushnell at [email protected] if you encounter any problems.
37 "
38 }
39
40 #This block allows symlinked shellscripts to correctly set classpath.
41 pushd . > /dev/null
42 DIR="${BASH_SOURCE[0]}"
43 while [ -h "$DIR" ]; do
44 cd "$(dirname "$DIR")"
45 DIR="$(readlink "$(basename "$DIR")")"
46 done
47 cd "$(dirname "$DIR")"
48 DIR="$(pwd)/"
49 popd > /dev/null
50
51 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
52 CP="$DIR""current/"
53
54 z="-Xmx3g"
55 z2="-Xms3g"
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 3000m 84
71 z="-Xmx${RAM}m"
72 z2="-Xms${RAM}m"
73 }
74 calcXmx "$@"
75
76 dedupebymapping() {
77 local CMD="java $EA $EOOM $z $z2 -cp $CP jgi.DedupeByMapping $@"
78 echo $CMD >&2
79 eval $CMD
80 }
81
82 dedupebymapping "$@"