Debian Codegraph @

tagandmerge.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified May 16, 2024
7
8 Description: Accepts multiple input files from a demultiplexed lane.
9 Parses the barcode from the filename and adds (tab)BARCODE to read headers.
10 Outputs all reads into a single file. Optionally, trims bases and drops R2.
11 Intended for evaluating demultiplexing methods. For example:
12 tagandmerge.sh path/*0.*.fastq.gz dropr2 trim out=tagged.fq.gz barcodes=bc.txt
13
14 Usage: tagandmerge.sh *.fastq.gz out=<output file>
15 or
16 tagandmerge.sh in=<file,file,file> out=<output file>
17
18 Input may be fasta or fastq, compressed or uncompressed.
19
20 Standard parameters:
21 in=<file,file> A comma-delimited list of files. If wildcards are used,
22 omit in= and the commas.
23 out=<file> Print all reads to this destination.
24 barcodes=<file> Print barcodes from file names to this destination.
25 trim=-1 If positive, trim all reads to this length.
26 dropr2=f Discard read 2 if the input is interleaved.
27 shrinkheader=f (shrink) Illumina only; remove unnecessary header fields.
28 remap=-+ Remap symbols in the barcode. By default, '+' replaces '-'.
29 To eliminate this set 'remap=null'.
30
31 Please contact Brian Bushnell at [email protected] if you encounter any problems.
32 "
33 }
34
35 #This block allows symlinked shellscripts to correctly set classpath.
36 pushd . > /dev/null
37 DIR="${BASH_SOURCE[0]}"
38 while [ -h "$DIR" ]; do
39 cd "$(dirname "$DIR")"
40 DIR="$(readlink "$(basename "$DIR")")"
41 done
42 cd "$(dirname "$DIR")"
43 DIR="$(pwd)/"
44 popd > /dev/null
45
46 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
47 CP="$DIR""current/"
48
49 z="-Xmx300m"
50 z2="-Xms300m"
51 set=0
52
53 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
54 usage
55 exit
56 fi
57
58 calcXmx () {
59 source "$DIR""/calcmem.sh"
60 setEnvironment
61 parseXmx "$@"
62 }
63 calcXmx "$@"
64
65 function tagandmerge() {
66 local CMD="java $EA $EOOM $z $z2 -cp $CP barcode.TagAndMerge $@"
67 echo $CMD >&2
68 eval $CMD
69 }
70
71 tagandmerge "$@"