Debian Codegraph @

translate6frames.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified February 17, 2015
7
8 Description: Translates nucleotide sequences to all 6 amino acid frames,
9 or amino acids to a canonical nucleotide representation.
10 Input may be fasta or fastq, compressed or uncompressed.
11
12 Usage: translate6frames.sh in=<input file> out=<output file>
13
14 See also: callgenes.sh
15
16 Optional parameters (and their defaults)
17
18 Input parameters:
19 in=<file> Main input. in=stdin.fa will pipe from stdin.
20 in2=<file> Input for 2nd read of pairs in a different file.
21 int=auto (interleaved) t/f overrides interleaved autodetection.
22 qin=auto Input quality offset: 33 (Sanger), 64, or auto.
23 aain=f False if input is nucleotides, true for amino acids.
24 reads=-1 If positive, quit after processing X reads or pairs.
25
26 Output parameters:
27 out=<file> Write output here. 'out=stdout.fa' goes to standard out.
28 out2=<file> Use this to write 2nd read of pairs to a different file.
29 overwrite=t (ow) Grant permission to overwrite files.
30 append=f Append to existing files.
31 ziplevel=2 (zl) Compression level; 1 (min) through 9 (max).
32 fastawrap=80 Length of lines in fasta output.
33 qout=auto Output quality offset: 33 (Sanger), 64, or auto.
34 aaout=t False to output nucleotides, true for amino acids.
35 tag=t Tag read id with the frame, adding e.g. ' fr1'
36 frames=6 Only print this many frames.
37 If you already know the sense, set 'frames=3'.
38
39 Java Parameters:
40 -Xmx This will set Java's memory usage, overriding autodetection.
41 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
42 The max is typically 85% of physical memory.
43 -eoom This flag will cause the process to exit if an out-of-memory
44 exception occurs. Requires Java 8u92+.
45 -da Disable assertions.
46
47 Please contact Brian Bushnell at [email protected] if you encounter any problems.
48 "
49
50 }
51
52 #This block allows symlinked shellscripts to correctly set classpath.
53 pushd . > /dev/null
54 DIR="${BASH_SOURCE[0]}"
55 while [ -h "$DIR" ]; do
56 cd "$(dirname "$DIR")"
57 DIR="$(readlink "$(basename "$DIR")")"
58 done
59 cd "$(dirname "$DIR")"
60 DIR="$(pwd)/"
61 popd > /dev/null
62
63 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
64 CP="$DIR""current/"
65
66 z="-Xmx2g"
67 z2="-Xms2g"
68 set=0
69
70 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
71 usage
72 exit
73 fi
74
75 calcXmx () {
76 source "$DIR""/calcmem.sh"
77 setEnvironment
78 parseXmx "$@"
79 if [[ $set == 1 ]]; then
80 return
81 fi
82 freeRam 2000m 42
83 z="-Xmx${RAM}m"
84 z2="-Xms${RAM}m"
85 }
86 calcXmx "$@"
87
88 translate6frames() {
89 local CMD="java $EA $EOOM $z -cp $CP jgi.TranslateSixFrames $@"
90 echo $CMD >&2
91 eval $CMD
92 }
93
94 translate6frames "$@"