Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/decontaminate.sh @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 #!/bin/bash | |
2 | |
3 usage(){ | |
4 echo " | |
5 Written by Brian Bushnell. | |
6 Last modified June 28, 2016 | |
7 | |
8 Description: Decontaminates multiplexed assemblies via normalization and mapping. | |
9 | |
10 Usage: decontaminate.sh reads=<file,file> ref=<file,file> out=<directory> | |
11 or | |
12 decontaminate.sh readnamefile=<file> refnamefile=<file> out=<directory> | |
13 | |
14 Input Parameters: | |
15 reads=<file,file> Input reads, one file per library. | |
16 ref=<file,file> Input assemblies, one file per library. | |
17 readnamefile=<file> List of input reads, one line per library. | |
18 refnamefile=<file> List of input assemblies, one line per library. | |
19 | |
20 interleaved=auto True forces paired/interleaved input; false forces single-ended mapping. | |
21 If not specified, interleaved status will be autodetected from read names. | |
22 unpigz=t Spawn a pigz (parallel gzip) process for faster decompression. Requires pigz to be installed. | |
23 touppercase=t (tuc) Convert lowercase letters in reads to upper case (otherwise they will not match the reference). | |
24 | |
25 Output Parameters: | |
26 pigz=f Spawn a pigz (parallel gzip) process for faster compression. Requires pigz to be installed. | |
27 tmpdir=. Write temp files here. By default is uses the system's $TMPDIR or current directory. | |
28 outdir=. Write ouput files here. | |
29 | |
30 Mapping Parameters: | |
31 kfilter=55 Set to a positive number N to require minimum N contiguous matches for a mapped read. | |
32 ambig=random Determines how coverage will be calculated for ambiguously-mapped reads. | |
33 first: Add coverage only at first genomic mapping location. | |
34 random: Add coverage at a random best-scoring location. | |
35 all: Add coverage at all best-scoring locations. | |
36 toss: Discard ambiguously-mapped reads without adding coverage. | |
37 | |
38 Filtering Parameters: | |
39 minc=3.5 Min average coverage to retain scaffold. | |
40 minp=20 Min percent coverage to retain scaffold. | |
41 minr=18 Min mapped reads to retain scaffold. | |
42 minl=500 Min length to retain scaffold. | |
43 ratio=1.2 Contigs will not be removed by minc unless the coverage changed by at least this factor. 0 disables this filter. | |
44 mapraw=t Set true to map the unnormalized reads. Required to filter by 'ratio'. | |
45 basesundermin=-1 If positive, removes contigs with at least this many bases in low-coverage windows. | |
46 window=500 Sliding window size | |
47 windowcov=5 Average coverage below this will be classified as low. | |
48 | |
49 Tadpole Parameters: | |
50 ecct=f Error-correct with Tadpole before normalization. | |
51 kt=42 Kmer length for Tadpole. | |
52 aggressive=f Do aggressive error correction. | |
53 conservative=f Do conservative error correction. | |
54 tadpoleprefilter=1 (tadpre) Ignore kmers under this depth to save memory. | |
55 | |
56 Normalization Parameters: | |
57 mindepth=2 Min depth of reads to keep. | |
58 target=20 Target normalization depth. | |
59 hashes=4 Number of hashes in Bloom filter. | |
60 passes=1 Normalization passes. | |
61 minprob=0.5 Min probability of correctness to add a kmer. | |
62 dp=0.75 (depthpercentile) Percentile to use for depth proxy (0.5 means median). | |
63 prefilter=t Prefilter, for large datasets. | |
64 filterbits=32 (fbits) Bits per cell in primary filter. | |
65 prefilterbits=2 (pbits) Bits per cell in prefilter. | |
66 k=31 Kmer length for normalization. Longer is more precise but less sensitive. | |
67 | |
68 Other parameters: | |
69 opfn=0 (onlyprocessfirstn) Set to a positive number to only process that many datasets. This is for internal testing of specificity. | |
70 | |
71 Java Parameters: | |
72 -Xmx This will set Java's memory usage, overriding autodetection. | |
73 -Xmx20g will specify 20 gigs of RAM, and -Xmx800m will specify 800 megs. | |
74 The max is typically 85% of physical memory. | |
75 -eoom This flag will cause the process to exit if an | |
76 out-of-memory exception occurs. Requires Java 8u92+. | |
77 -da Disable assertions. | |
78 | |
79 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. | |
80 " | |
81 } | |
82 | |
83 #This block allows symlinked shellscripts to correctly set classpath. | |
84 pushd . > /dev/null | |
85 DIR="${BASH_SOURCE[0]}" | |
86 while [ -h "$DIR" ]; do | |
87 cd "$(dirname "$DIR")" | |
88 DIR="$(readlink "$(basename "$DIR")")" | |
89 done | |
90 cd "$(dirname "$DIR")" | |
91 DIR="$(pwd)/" | |
92 popd > /dev/null | |
93 | |
94 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" | |
95 CP="$DIR""current/" | |
96 JNI="-Djava.library.path=""$DIR""jni/" | |
97 JNI="" | |
98 | |
99 z="-Xmx1g" | |
100 z2="-Xms1g" | |
101 set=0 | |
102 | |
103 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then | |
104 usage | |
105 exit | |
106 fi | |
107 | |
108 calcXmx () { | |
109 source "$DIR""/calcmem.sh" | |
110 setEnvironment | |
111 parseXmx "$@" | |
112 if [[ $set == 1 ]]; then | |
113 return | |
114 fi | |
115 freeRam 15000m 84 | |
116 z="-Xmx${RAM}m" | |
117 z2="-Xms${RAM}m" | |
118 } | |
119 calcXmx "$@" | |
120 | |
121 | |
122 decontaminate() { | |
123 local CMD="java $JNI $EA $EOOM $z $z2 -cp $CP jgi.DecontaminateByNormalization $@" | |
124 echo $CMD >&2 | |
125 eval $CMD | |
126 } | |
127 | |
128 decontaminate "$@" |