Debian Codegraph @

reformatpb.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified June 16, 2020
7
8 Description: Provides some of Reformat's functionality in a ZMW-aware tool.
9
10 Usage: reformatpb.sh in=<input file> out=<output file> outb=<bad reads>
11
12 File I/O parameters:
13 in=<file> Primary input.
14 out=<file> (outgood) Output for good reads.
15 outb=<file> (outbad) Output for discarded reads.
16 stats=<file> Print screen output here instead of to the screen.
17 json=f Print stats as json.
18 schist=<file> Subread count per ZMW histogram.
19 overwrite=f (ow) Set to false to force the program to abort rather than
20 overwrite an existing file.
21 ziplevel=2 (zl) Set to 1 (lowest) through 9 (max) to change compression
22 level; lower compression is faster.
23
24 Processing parameters:
25 kzt=f (keepzmwstogether) Send all reads from a ZMW to the same file,
26 either good or bad output.
27 minlen=40 Do not output reads shorter than this, after trimming.
28 ccsin=f Input reads are CCS, meaning they are all full-pass.
29 Not currently used for anything.
30 trimpolya=f Trim terminal poly-A and poly-T sequences, for some isoseq
31 libraries.
32 minpolymer=5 Don't trim poly-A sequence shorter than this.
33 polyerror=0.2 Max error rate for trimming poly-A.
34 flaglongreads=f True to flag reads longer than 1.5x median to be discarded.
35 longreadmult=1.5 Multiplier to consider a read suspiciously long.
36
37 Whitelists and Blacklists:
38 whitelist= ZMW identifiers, as a comma-delimited list of integers,
39 or files with one integer per line. All ZMWs not in the
40 list will be discarded.
41 blacklist= All ZMWs in the list will be discarded.
42
43 Sampling parameters (avoid using more than one of these at a time):
44 reads=-1 If positive, quit after processing this many reads.
45 zmws=-1 If positive, quit after processing this many ZMWs.
46 bestpass=f Set to true to keep only the best read per ZMW. This is
47 the median length read of the non-outermost reads.
48 If there are 2 or fewer passes, the longest will be chosen.
49 longestpass=f Set to true to keep only the longest read per ZMW.
50 samplerate=1.0 Retain this fraction of input reads.
51 samplereadstarget=-1 If positive, retain this many reads.
52 samplebasestarget=-1 If positive, retain this many bases.
53 samplezmwstarget=-1 If positive, retain this many ZMWs.
54 subsamplefromends=f If true, eliminate outermost reads first, then inner.
55
56 CCS Parameters (Note: CCS is still experimental)
57 ccs=f Make a single consensus read per ZMW (CPU-intensive).
58 minpasses=0 Discard ZMWs with fewer than this many passes (estimated;
59 first and last subread are usually partial).
60 minsubreads=0 Discard ZMWs with fewer than this many subreads.
61 reorient=f Try aligning both strands in case ZMW ordering is broken.
62 minshredid=0.6 Do not include shreds with identity below this in consensus.
63
64 Entropy parameters (recommended setting is 'entropy=t'):
65 minentropy=-1 Set to 0.4 or above to remove low-entropy reads;
66 range is 0-1, recommended value is 0.55. 0.7 is too high.
67 Negative numbers disable this function.
68 entropyk=3 Kmer length for entropy calculation.
69 entropylen=350 Reads with entropy below cutoff for at least this many
70 consecutive bases will be removed.
71 entropyfraction=0.5 Alternative minimum length for short reads; the shorter
72 of entropylen and entfraction*readlength will be used.
73 entropywindow=50 Window size used for entropy calculation.
74 maxmonomerfraction=0.74 (mmf) Also require this fraction of bases in each
75 window to be the same base.
76
77 Java Parameters:
78 -Xmx This will set Java's memory usage, overriding autodetection.
79 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will
80 specify 200 megs. The max is typically 85% of physical memory.
81 -eoom This flag will cause the process to exit if an out-of-memory
82 exception occurs. Requires Java 8u92+.
83 -da Disable assertions.
84
85 Please contact Brian Bushnell at [email protected] if you encounter any problems.
86 "
87 }
88
89 #This block allows symlinked shellscripts to correctly set classpath.
90 pushd . > /dev/null
91 DIR="${BASH_SOURCE[0]}"
92 while [ -h "$DIR" ]; do
93 cd "$(dirname "$DIR")"
94 DIR="$(readlink "$(basename "$DIR")")"
95 done
96 cd "$(dirname "$DIR")"
97 DIR="$(pwd)/"
98 popd > /dev/null
99
100 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
101 CP="$DIR""current/"
102 JNI="-Djava.library.path=""$DIR""jni/"
103 #JNI=""
104
105 z="-Xmx2g"
106 z2="-Xms2g"
107 #z3="-Xss16m"
108 set=0
109
110 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
111 usage
112 exit
113 fi
114
115 calcXmx () {
116 source "$DIR""/calcmem.sh"
117 setEnvironment
118 parseXmx "$@"
119 if [[ $set == 1 ]]; then
120 return
121 fi
122 freeRam 2000m 42
123 z="-Xmx${RAM}m"
124 z2="-Xms${RAM}m"
125 }
126 calcXmx "$@"
127
128 reformatpb() {
129 local CMD="java $EA $EOOM $z $z2 -cp $CP icecream.ReformatPacBio $@"
130 if [[ $silent != 1 ]]; then
131 echo $CMD >&2
132 fi
133 eval $CMD
134 }
135
136 reformatpb "$@"