Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/stats.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 March 3, 2020 | |
7 | |
8 Description: Generates basic assembly statistics such as scaffold count, | |
9 N50, L50, GC content, gap percent, etc. For multiple files, please use | |
10 statswrapper.sh. Works with fasta and fastq only (gzipped is fine). | |
11 Please read bbmap/docs/guides/StatsGuide.txt for more information. | |
12 | |
13 Usage: stats.sh in=<file> | |
14 | |
15 Parameters: | |
16 in=file Specify the input fasta file, or stdin. | |
17 out=stdout Destination of primary output; may be directed to a file. | |
18 gc=file Writes ACGTN content per scaffold to a file. | |
19 gchist=file Filename to output scaffold gc content histogram. | |
20 shist=file Filename to output cumulative scaffold length histogram. | |
21 gcbins=200 Number of bins for gc histogram. | |
22 n=10 Number of contiguous Ns to signify a break between contigs. | |
23 k=13 Estimate memory usage of BBMap with this kmer length. | |
24 minscaf=0 Ignore scaffolds shorter than this. | |
25 phs=f (printheaderstats) Set to true to print total size of headers. | |
26 n90=t (printn90) Print the N/L90 metrics. | |
27 extended=f Print additional metrics such as L90, logsum, and score. | |
28 pdl=f (printduplicatelines) Set to true to print lines in the | |
29 scaffold size table where the counts did not change. | |
30 n_=t This flag will prefix the terms 'contigs' and 'scaffolds' | |
31 with 'n_' in formats 3-6. | |
32 addname=f Adds a column for input file name, for formats 3-6. | |
33 | |
34 Logsum and Powsum: | |
35 logoffset=1000 Minimum length for calculating log sum. | |
36 logbase=2 Log base for calculating log sum. | |
37 logpower=1 Raise the log to a power to increase the weight | |
38 of longer scaffolds for log sum. | |
39 powsum=0.25 Use this power of the length to increase weight | |
40 of longer scaffolds for power sum. | |
41 | |
42 Assembly Score Metric: | |
43 score=f Print assembly score. | |
44 aligned=0.0 Set the fraction of aligned reads (0-1). | |
45 assemblyscoreminlen=2000 Minimum length of scaffolds to include in | |
46 assembly score calculation. | |
47 assemblyscoremaxlen=50000 Maximum length of scaffolds to get bonus points | |
48 for being long. | |
49 | |
50 | |
51 format=<0-7> Format of the stats information; default 1. | |
52 format=0 prints no assembly stats. | |
53 format=1 uses variable units like MB and KB, and is designed for compatibility with existing tools. | |
54 format=2 uses only whole numbers of bases, with no commas in numbers, and is designed for machine parsing. | |
55 format=3 outputs stats in 2 rows of tab-delimited columns: a header row and a data row. | |
56 format=4 is like 3 but with scaffold data only. | |
57 format=5 is like 3 but with contig data only. | |
58 format=6 is like 3 but the header starts with a #. | |
59 format=7 is like 1 but only prints contig info. | |
60 format=8 is like 3 but in JSON. You can also just use the 'json' flag. | |
61 | |
62 gcformat=<0-5> Select GC output format; default 1. | |
63 gcformat=0: (no base content info printed) | |
64 gcformat=1: name length A C G T N GC | |
65 gcformat=2: name GC | |
66 gcformat=4: name length GC | |
67 gcformat=5: name length GC logsum powsum | |
68 Note that in gcformat 1, A+C+G+T=1 even when N is nonzero. | |
69 | |
70 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. | |
71 " | |
72 } | |
73 | |
74 #This block allows symlinked shellscripts to correctly set classpath. | |
75 pushd . > /dev/null | |
76 DIR="${BASH_SOURCE[0]}" | |
77 while [ -h "$DIR" ]; do | |
78 cd "$(dirname "$DIR")" | |
79 DIR="$(readlink "$(basename "$DIR")")" | |
80 done | |
81 cd "$(dirname "$DIR")" | |
82 DIR="$(pwd)/" | |
83 popd > /dev/null | |
84 | |
85 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" | |
86 CP="$DIR""current/" | |
87 | |
88 z="-Xmx120m" | |
89 set=0 | |
90 | |
91 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then | |
92 usage | |
93 exit | |
94 fi | |
95 | |
96 calcXmx () { | |
97 source "$DIR""/calcmem.sh" | |
98 setEnvironment | |
99 parseXmx "$@" | |
100 } | |
101 calcXmx "$@" | |
102 | |
103 stats() { | |
104 local CMD="java $EA $EOOM $z -cp $CP jgi.AssemblyStats2 $@" | |
105 # echo $CMD >&2 | |
106 eval $CMD | |
107 } | |
108 | |
109 stats "$@" |