jpayne@69
|
1 #!/bin/bash
|
jpayne@69
|
2
|
jpayne@69
|
3 usage(){
|
jpayne@69
|
4 echo "
|
jpayne@69
|
5 Written by Brian Bushnell
|
jpayne@69
|
6 Last modified April 24, 2019
|
jpayne@69
|
7
|
jpayne@69
|
8 Description: Reformats a fungal assembly for release.
|
jpayne@69
|
9 Also creates contig and agp files.
|
jpayne@69
|
10
|
jpayne@69
|
11 Usage: fungalrelease.sh in=<input file> out=<output file>
|
jpayne@69
|
12
|
jpayne@69
|
13 I/O parameters:
|
jpayne@69
|
14 in=<file> Input scaffolds.
|
jpayne@69
|
15 out=<file> Output scaffolds.
|
jpayne@69
|
16 outc=<file> Output contigs.
|
jpayne@69
|
17 qfin=<file> Optional quality scores input.
|
jpayne@69
|
18 qfout=<file> Optional quality scores output.
|
jpayne@69
|
19 qfoutc=<file> Optional contig quality scores output.
|
jpayne@69
|
20 agp=<file> Output AGP file.
|
jpayne@69
|
21 legend=<file> Output name legend file.
|
jpayne@69
|
22 overwrite=f (ow) Set to false to force the program to abort rather than
|
jpayne@69
|
23 overwrite an existing file.
|
jpayne@69
|
24
|
jpayne@69
|
25 Processing parameters:
|
jpayne@69
|
26 fastawrap=60 Wrap length for fasta lines.
|
jpayne@69
|
27 tuc=t Convert sequence to upper case.
|
jpayne@69
|
28 baniupac=t Crash on encountering a non-ACGTN base call.
|
jpayne@69
|
29 mingap=10 Expand all gaps (Ns) to be at least this long.
|
jpayne@69
|
30 mingapin=1 Only expand gaps that are at least this long.
|
jpayne@69
|
31 sortcscaffolds=t Sort scaffolds descending by length.
|
jpayne@69
|
32 sortcontigs=f Sort contigs descending by length.
|
jpayne@69
|
33 renamescaffolds=t Rename scaffolds to 'scaffold_#'.
|
jpayne@69
|
34 scafnum=1 Number of first scaffold.
|
jpayne@69
|
35 renamecontigs=f Rename contigs to 'contig_#' instead of 'scafname_c#'.
|
jpayne@69
|
36 contignum=1 Number of first contig; only used if renamecontigs=t.
|
jpayne@69
|
37 minscaf=1 Only retain scaffolds at least this long.
|
jpayne@69
|
38 mincontig=1 Only retain contigs at least this long.
|
jpayne@69
|
39
|
jpayne@69
|
40 Java Parameters:
|
jpayne@69
|
41 -Xmx This will set Java's memory usage, overriding autodetection.
|
jpayne@69
|
42 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
|
jpayne@69
|
43 The max is typically 85% of physical memory.
|
jpayne@69
|
44 -eoom This flag will cause the process to exit if an
|
jpayne@69
|
45 out-of-memory exception occurs. Requires Java 8u92+.
|
jpayne@69
|
46 -da Disable assertions.
|
jpayne@69
|
47
|
jpayne@69
|
48 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
|
jpayne@69
|
49 "
|
jpayne@69
|
50 }
|
jpayne@69
|
51
|
jpayne@69
|
52 #This block allows symlinked shellscripts to correctly set classpath.
|
jpayne@69
|
53 pushd . > /dev/null
|
jpayne@69
|
54 DIR="${BASH_SOURCE[0]}"
|
jpayne@69
|
55 while [ -h "$DIR" ]; do
|
jpayne@69
|
56 cd "$(dirname "$DIR")"
|
jpayne@69
|
57 DIR="$(readlink "$(basename "$DIR")")"
|
jpayne@69
|
58 done
|
jpayne@69
|
59 cd "$(dirname "$DIR")"
|
jpayne@69
|
60 DIR="$(pwd)/"
|
jpayne@69
|
61 popd > /dev/null
|
jpayne@69
|
62
|
jpayne@69
|
63 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
jpayne@69
|
64 CP="$DIR""current/"
|
jpayne@69
|
65
|
jpayne@69
|
66 z="-Xmx4g"
|
jpayne@69
|
67 z2="-Xms4g"
|
jpayne@69
|
68 set=0
|
jpayne@69
|
69
|
jpayne@69
|
70 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
|
jpayne@69
|
71 usage
|
jpayne@69
|
72 exit
|
jpayne@69
|
73 fi
|
jpayne@69
|
74
|
jpayne@69
|
75 calcXmx () {
|
jpayne@69
|
76 source "$DIR""/calcmem.sh"
|
jpayne@69
|
77 setEnvironment
|
jpayne@69
|
78 parseXmx "$@"
|
jpayne@69
|
79 if [[ $set == 1 ]]; then
|
jpayne@69
|
80 return
|
jpayne@69
|
81 fi
|
jpayne@69
|
82 }
|
jpayne@69
|
83 calcXmx "$@"
|
jpayne@69
|
84
|
jpayne@69
|
85 fungalrelease() {
|
jpayne@69
|
86 local CMD="java $EOOM $EA $EOOM $z $z2 -cp $CP jgi.FungalRelease $@"
|
jpayne@69
|
87 echo $CMD >&2
|
jpayne@69
|
88 eval $CMD
|
jpayne@69
|
89 }
|
jpayne@69
|
90
|
jpayne@69
|
91 fungalrelease "$@"
|