Debian Codegraph @

countbarcodes2.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified May 14, 2024
7
8 Description: Counts and summarizes the number of reads with each barcode,
9 using class BarcodeStats. Can also do barcode assignment.
10
11 Usage: countbarcodes.sh in=<file> counts=<file>
12
13 Input may be stdin or a fasta or fastq file, raw or gzipped.
14
15 Input Parameters:
16 in=<file> Input reads, whose names end in a colon then barcode.
17 countsin=<file> Input of counts; optional.
18 quantset=<file> Only quantify barcodes in this file.
19 interleaved=auto (int) If true, fastq input will be considered interleaved.
20 expected= Comma-delimited list of expected bar codes.
21
22 Output parameters:
23 maxrows=-1 Optionally limit the number of rows printed.
24 printheader=t Print a header.
25 out=<file> (counts) Write bar codes and counts here. 'out=stdout'
26 will pipe to standard out.
27 barcodesout=<file> Barcode assignment counts.
28 mapout=<file> Map of observed to expected barcode assignments.
29 outcontam=<file> Requires labeled data, and causes contam quantification.
30
31 Processing Parameters:
32 countundefined=t Count barcodes that contain non-ACGT symbols.
33 pcrmatrix=f Use a PCRMatrix for barcode assignment.
34 mode=hdist PCRMatrix type.
35
36
37 Java Parameters:
38 -Xmx This will set Java's memory usage, overriding autodetection.
39 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
40 The max is typically 85% of physical memory.
41 -eoom This flag will cause the process to exit if an
42 out-of-memory exception occurs. Requires Java 8u92+.
43 -da Disable assertions.
44
45 Please contact Brian Bushnell at [email protected] if you encounter any problems.
46 "
47 }
48
49 #This block allows symlinked shellscripts to correctly set classpath.
50 pushd . > /dev/null
51 DIR="${BASH_SOURCE[0]}"
52 while [ -h "$DIR" ]; do
53 cd "$(dirname "$DIR")"
54 DIR="$(readlink "$(basename "$DIR")")"
55 done
56 cd "$(dirname "$DIR")"
57 DIR="$(pwd)/"
58 popd > /dev/null
59
60 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
61 CP="$DIR""current/"
62
63 z="-Xmx2g"
64 set=0
65
66 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
67 usage
68 exit
69 fi
70
71 calcXmx () {
72 source "$DIR""/calcmem.sh"
73 setEnvironment
74 parseXmx "$@"
75 }
76 calcXmx "$@"
77
78 countbarcodes() {
79 local CMD="java $EA $EOOM $z -cp $CP barcode.CountBarcodes2 $@"
80 echo $CMD >&2
81 eval $CMD
82 }
83
84 countbarcodes "$@"