jpayne@69
|
1 #!/bin/bash
|
jpayne@69
|
2
|
jpayne@69
|
3 usage(){
|
jpayne@69
|
4 echo "
|
jpayne@69
|
5 Written by Brian Bushnell
|
jpayne@69
|
6 Last modified August 1, 2016
|
jpayne@69
|
7
|
jpayne@69
|
8 Description: Generates a kmer uniqueness histogram, binned by file position.
|
jpayne@69
|
9 There are 3 columns for single reads, 6 columns for paired:
|
jpayne@69
|
10 count number of reads or pairs processed
|
jpayne@69
|
11 r1_first percent unique 1st kmer of read 1
|
jpayne@69
|
12 r1_rand percent unique random kmer of read 1
|
jpayne@69
|
13 r2_first percent unique 1st kmer of read 2
|
jpayne@69
|
14 r2_rand percent unique random kmer of read 2
|
jpayne@69
|
15 pair percent unique concatenated kmer from read 1 and 2
|
jpayne@69
|
16
|
jpayne@69
|
17 Please read bbmap/docs/guides/CalcUniquenessGuide.txt for more information.
|
jpayne@69
|
18
|
jpayne@69
|
19 Usage: bbcountunique.sh in=<input> out=<output>
|
jpayne@69
|
20
|
jpayne@69
|
21 Input parameters:
|
jpayne@69
|
22 in2=null Second input file for paired reads
|
jpayne@69
|
23 interleaved=auto Set true/false to override autodetection of the input file as paired interleaved.
|
jpayne@69
|
24 samplerate=1 Set to below 1 to sample a fraction of input reads.
|
jpayne@69
|
25 reads=-1 Only process this number of reads, then quit (-1 means all)
|
jpayne@69
|
26
|
jpayne@69
|
27 Output parameters:
|
jpayne@69
|
28 out=<file> File for output stats
|
jpayne@69
|
29
|
jpayne@69
|
30 Processing parameters:
|
jpayne@69
|
31 k=25 Kmer length (range 1-31).
|
jpayne@69
|
32 interval=25000 Print one line to the histogram per this many reads.
|
jpayne@69
|
33 cumulative=f Show cumulative numbers rather than per-interval numbers.
|
jpayne@69
|
34 percent=t Show percentages of unique reads.
|
jpayne@69
|
35 count=f Show raw counts of unique reads.
|
jpayne@69
|
36 printlastbin=f (plb) Print a line for the final undersized bin.
|
jpayne@69
|
37 minprob=0 Ignore kmers with a probability of correctness below this (based on q-scores).
|
jpayne@69
|
38
|
jpayne@69
|
39 Java Parameters:
|
jpayne@69
|
40 -Xmx This will set Java's memory usage, overriding autodetection.
|
jpayne@69
|
41 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
|
jpayne@69
|
42 The max is typically 85% of physical memory.
|
jpayne@69
|
43 -eoom This flag will cause the process to exit if an
|
jpayne@69
|
44 out-of-memory exception occurs. Requires Java 8u92+.
|
jpayne@69
|
45 -da Disable assertions.
|
jpayne@69
|
46
|
jpayne@69
|
47 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
|
jpayne@69
|
48 "
|
jpayne@69
|
49 }
|
jpayne@69
|
50
|
jpayne@69
|
51 #This block allows symlinked shellscripts to correctly set classpath.
|
jpayne@69
|
52 pushd . > /dev/null
|
jpayne@69
|
53 DIR="${BASH_SOURCE[0]}"
|
jpayne@69
|
54 while [ -h "$DIR" ]; do
|
jpayne@69
|
55 cd "$(dirname "$DIR")"
|
jpayne@69
|
56 DIR="$(readlink "$(basename "$DIR")")"
|
jpayne@69
|
57 done
|
jpayne@69
|
58 cd "$(dirname "$DIR")"
|
jpayne@69
|
59 DIR="$(pwd)/"
|
jpayne@69
|
60 popd > /dev/null
|
jpayne@69
|
61
|
jpayne@69
|
62 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
jpayne@69
|
63 CP="$DIR""current/"
|
jpayne@69
|
64
|
jpayne@69
|
65 z="-Xmx1g"
|
jpayne@69
|
66 z2="-Xms1g"
|
jpayne@69
|
67 set=0
|
jpayne@69
|
68
|
jpayne@69
|
69 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
|
jpayne@69
|
70 usage
|
jpayne@69
|
71 exit
|
jpayne@69
|
72 fi
|
jpayne@69
|
73
|
jpayne@69
|
74 calcXmx () {
|
jpayne@69
|
75 source "$DIR""/calcmem.sh"
|
jpayne@69
|
76 setEnvironment
|
jpayne@69
|
77 parseXmx "$@"
|
jpayne@69
|
78 if [[ $set == 1 ]]; then
|
jpayne@69
|
79 return
|
jpayne@69
|
80 fi
|
jpayne@69
|
81 freeRam 3200m 84
|
jpayne@69
|
82 z="-Xmx${RAM}m"
|
jpayne@69
|
83 z2="-Xms${RAM}m"
|
jpayne@69
|
84 }
|
jpayne@69
|
85 calcXmx "$@"
|
jpayne@69
|
86
|
jpayne@69
|
87 bbcountunique() {
|
jpayne@69
|
88 local CMD="java $EA $EOOM $z $z2 -cp $CP jgi.CalcUniqueness $@"
|
jpayne@69
|
89 echo $CMD >&2
|
jpayne@69
|
90 eval $CMD
|
jpayne@69
|
91 }
|
jpayne@69
|
92
|
jpayne@69
|
93 bbcountunique "$@"
|