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 February 17, 2015
|
jpayne@69
|
7
|
jpayne@69
|
8 Description: Generates fake read pairs from ends of contigs or single reads.
|
jpayne@69
|
9
|
jpayne@69
|
10 Usage: bbfakereads.sh in=<file> out=<outfile> out2=<outfile2>
|
jpayne@69
|
11
|
jpayne@69
|
12 Out2 is optional; if there is only one output file, it will be written interleaved.
|
jpayne@69
|
13
|
jpayne@69
|
14 Standard parameters:
|
jpayne@69
|
15 ow=f (overwrite) Overwrites files that already exist.
|
jpayne@69
|
16 zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max).
|
jpayne@69
|
17 fastawrap=100 Length of lines in fasta output.
|
jpayne@69
|
18 tuc=f (touppercase) Change lowercase letters in reads to uppercase.
|
jpayne@69
|
19 qin=auto ASCII offset for input quality. May be 33 (Sanger), 64 (Illumina), or auto.
|
jpayne@69
|
20 qout=auto ASCII offset for output quality. May be 33 (Sanger), 64 (Illumina), or auto (same as input).
|
jpayne@69
|
21 qfin=<.qual file> Read qualities from this qual file, for the reads coming from 'in=<fasta file>'
|
jpayne@69
|
22 qfout=<.qual file> Write qualities from this qual file, for the reads going to 'out=<fasta file>'
|
jpayne@69
|
23 qfout2=<.qual file> Write qualities from this qual file, for the reads coming from 'out2=<fasta file>'
|
jpayne@69
|
24 verifyinterleaved=f (vint) When true, checks a file to see if the names look paired. Prints an error message if not.
|
jpayne@69
|
25 tossbrokenreads=f (tbr) Discard reads that have different numbers of bases and qualities. By default this will be detected and cause a crash.
|
jpayne@69
|
26
|
jpayne@69
|
27 Faking parameters:
|
jpayne@69
|
28 length=250 Generate reads of this length.
|
jpayne@69
|
29 minlength=1 Don't generate reads shorter than this.
|
jpayne@69
|
30 overlap=0 If you set overlap, then reads will by variable length, overlapping by 'overlap' in the middle.
|
jpayne@69
|
31 identifier=null (id) Output read names are prefixed with this.
|
jpayne@69
|
32 addspace=t Set to false to omit the space before /1 and /2 of paired reads.
|
jpayne@69
|
33
|
jpayne@69
|
34 Java Parameters:
|
jpayne@69
|
35 -Xmx This will set Java's memory usage, overriding autodetection.
|
jpayne@69
|
36 -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
|
jpayne@69
|
37 The max is typically 85% of physical memory.
|
jpayne@69
|
38 -eoom This flag will cause the process to exit if an
|
jpayne@69
|
39 out-of-memory exception occurs. Requires Java 8u92+.
|
jpayne@69
|
40 -da Disable assertions.
|
jpayne@69
|
41
|
jpayne@69
|
42 Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
|
jpayne@69
|
43 "
|
jpayne@69
|
44 }
|
jpayne@69
|
45
|
jpayne@69
|
46 #This block allows symlinked shellscripts to correctly set classpath.
|
jpayne@69
|
47 pushd . > /dev/null
|
jpayne@69
|
48 DIR="${BASH_SOURCE[0]}"
|
jpayne@69
|
49 while [ -h "$DIR" ]; do
|
jpayne@69
|
50 cd "$(dirname "$DIR")"
|
jpayne@69
|
51 DIR="$(readlink "$(basename "$DIR")")"
|
jpayne@69
|
52 done
|
jpayne@69
|
53 cd "$(dirname "$DIR")"
|
jpayne@69
|
54 DIR="$(pwd)/"
|
jpayne@69
|
55 popd > /dev/null
|
jpayne@69
|
56
|
jpayne@69
|
57 #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
jpayne@69
|
58 CP="$DIR""current/"
|
jpayne@69
|
59
|
jpayne@69
|
60 z="-Xmx600m"
|
jpayne@69
|
61 set=0
|
jpayne@69
|
62
|
jpayne@69
|
63 if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
|
jpayne@69
|
64 usage
|
jpayne@69
|
65 exit
|
jpayne@69
|
66 fi
|
jpayne@69
|
67
|
jpayne@69
|
68
|
jpayne@69
|
69 calcXmx () {
|
jpayne@69
|
70 source "$DIR""/calcmem.sh"
|
jpayne@69
|
71 setEnvironment
|
jpayne@69
|
72 parseXmx "$@"
|
jpayne@69
|
73 }
|
jpayne@69
|
74 calcXmx "$@"
|
jpayne@69
|
75
|
jpayne@69
|
76 function fakereads() {
|
jpayne@69
|
77 local CMD="java $EA $EOOM $z -cp $CP jgi.FakeReads $@"
|
jpayne@69
|
78 echo $CMD >&2
|
jpayne@69
|
79 eval $CMD
|
jpayne@69
|
80 }
|
jpayne@69
|
81
|
jpayne@69
|
82 fakereads "$@"
|