Debian Codegraph @

statswrapper.sh

raw symbols SCIP
1 #!/bin/bash
2
3 usage(){
4 echo "
5 Written by Brian Bushnell
6 Last modified August 1, 2017
7
8 Description: Runs stats.sh on multiple assemblies to produce one output line per file.
9
10 Usage: statswrapper.sh in=<input file>
11
12 Parameters:
13 in=<file> Specify the input fasta file, or stdin. For multiple files a, b, and c: 'statswrapper.sh in=a,b,c'.
14 'in=' may be omitted if this is the first arg, and asterisks may be used; e.g. statswrapper.sh *.fa
15 gc=<file> Writes ACGTN content per scaffold to a file.
16 gchist=<file> Filename to output scaffold gc content histogram.
17 gcbins=<200> Number of bins for gc histogram.
18 n=<10> Number of contiguous Ns to signify a break between contigs.
19 k=<13> Estimate memory usage of BBMap with this kmer length.
20 minscaf=<0> Ignore scaffolds shorter than this.
21 n_=<t> This flag will prefix the terms 'contigs' and 'scaffolds' with 'n_' in formats 3-6.
22 addname=<t> Adds a column for input file name, for formats 3-6.
23
24 format=<1 through 6> Format of the stats information. Default is format=3.
25 format=1 uses variable units like MB and KB, and is designed for compatibility with existing tools.
26 format=2 uses only whole numbers of bases, with no commas in numbers, and is designed for machine parsing.
27 format=3 outputs stats in 2 rows of tab-delimited columns: a header row and a data row.
28 format=4 is like 3 but with scaffold data only.
29 format=5 is like 3 but with contig data only.
30 format=6 is like 3 but the header starts with a #.
31
32 gcformat=<1 or 2> Select GC output format.
33 gcformat=1: name start stop A C G T N GC
34 gcformat=2: name GC
35 Note that in gcformat 1, A+C+G+T=1 even when N is nonzero.
36 "
37 }
38
39 #This block allows symlinked shellscripts to correctly set classpath.
40 pushd . > /dev/null
41 DIR="${BASH_SOURCE[0]}"
42 while [ -h "$DIR" ]; do
43 cd "$(dirname "$DIR")"
44 DIR="$(readlink "$(basename "$DIR")")"
45 done
46 cd "$(dirname "$DIR")"
47 DIR="$(pwd)/"
48 popd > /dev/null
49
50 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
51 CP="$DIR""current/"
52
53 z="-Xmx200m"
54 set=0
55
56 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
57 usage
58 exit
59 fi
60
61 calcXmx () {
62 source "$DIR""/calcmem.sh"
63 setEnvironment
64 parseXmx "$@"
65 }
66 calcXmx "$@"
67
68 stats() {
69 local CMD="java $EA $EOOM $z -cp $CP jgi.AssemblyStatsWrapper format=3 $@"
70 echo $CMD >&2
71 eval $CMD
72 }
73
74 stats "$@"