comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/rename.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 April 1, 2020
7
8 Description: Renames reads to <prefix>_<number> where you specify the prefix
9 and the numbers are ordered. There are other renaming modes too.
10 If reads are paired, pairs should be processed together; if reads are
11 interleaved, the interleaved flag should be set. This ensures that if a
12 read number (such as 1: or 2:) is added, it will be added correctly.
13
14 Usage: rename.sh in=<file> in2=<file2> out=<outfile> out2=<outfile2> prefix=<>
15
16 in2 and out2 are for paired reads and are optional.
17 If input is paired and there is only one output file, it will be written interleaved.
18
19 Parameters:
20 prefix= The string to prepend to existing read names.
21 ow=f (overwrite) Overwrites files that already exist.
22 zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max).
23 int=f (interleaved) Determines whether INPUT file is considered interleaved.
24 fastawrap=70 Length of lines in fasta output.
25 minscaf=1 Ignore fasta reads shorter than this.
26 qin=auto ASCII offset for input quality. May be 33 (Sanger), 64 (Illumina), or auto.
27 qout=auto ASCII offset for output quality. May be 33 (Sanger), 64 (Illumina), or auto (same as input).
28 ignorebadquality=f (ibq) Fix out-of-range quality values instead of crashing with a warning.
29
30 Renaming modes (if not default):
31 renamebyinsert=f Rename the read to indicate its correct insert size.
32 renamebymapping=f Rename the read to indicate its correct mapping coordinates.
33 renamebytrim=f Rename the read to indicate its correct post-trimming length.
34 addprefix=f Rename the read by prepending the prefix to the existing name.
35 prefixonly=f Only use the prefix; don't add _<number>
36 addunderscore=t Add an underscore after the prefix (if there is a prefix).
37 addpairnum=t Add a pairnum (e.g. ' 1:') to paired reads in some modes.
38 fixsra=f Fixes headers of SRA reads renamed from Illumina.
39 Specifically, it converts something like this:
40 SRR17611.11 HWI-ST79:17:D091UACXX:4:1101:210:824 length=75
41 ...into this:
42 HWI-ST79:17:D091UACXX:4:1101:210:824 1:
43
44 Sampling parameters:
45 reads=-1 Set to a positive number to only process this many INPUT reads (or pairs), then quit.
46
47 Java Parameters:
48 -Xmx This will set Java's memory usage, overriding autodetection.
49 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
50 The max is typically 85% of physical memory.
51 -eoom This flag will cause the process to exit if an
52 out-of-memory exception occurs. Requires Java 8u92+.
53 -da Disable assertions.
54
55 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
56 "
57 }
58
59 #This block allows symlinked shellscripts to correctly set classpath.
60 pushd . > /dev/null
61 DIR="${BASH_SOURCE[0]}"
62 while [ -h "$DIR" ]; do
63 cd "$(dirname "$DIR")"
64 DIR="$(readlink "$(basename "$DIR")")"
65 done
66 cd "$(dirname "$DIR")"
67 DIR="$(pwd)/"
68 popd > /dev/null
69
70 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
71 CP="$DIR""current/"
72
73 z="-Xmx1g"
74 set=0
75
76 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
77 usage
78 exit
79 fi
80
81 calcXmx () {
82 source "$DIR""/calcmem.sh"
83 setEnvironment
84 parseXmx "$@"
85 }
86 calcXmx "$@"
87
88 function rename() {
89 local CMD="java $EA $EOOM $z -cp $CP jgi.RenameReads $@"
90 echo $CMD >&2
91 eval $CMD
92 }
93
94 rename "$@"