| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified February 17, 2015 |
| 7 | |
| 8 | ***DEPRECATED*** |
| 9 | |
| 10 | Description: Randomly adds adapters to a file, or grades a trimmed file. |
| 11 | The input is a set of reads, paired or unpaired. |
| 12 | The output is those same reads with adapter sequence replacing some of the bases in some reads. |
| 13 | For paired reads, adapters are located in the same position in read1 and read2. |
| 14 | This is designed for benchmarking adapter-trimming software, and evaluating methodology. |
| 15 | randomreads.sh is better for paired reads, though, as it actually adds adapters at the correct location, |
| 16 | so that overlap may be used for adapter detection. |
| 17 | |
| 18 | Usage: addadapters.sh in=<file> in2=<file2> out=<outfile> out2=<outfile2> adapters=<file> |
| 19 | |
| 20 | in2 and out2 are for paired reads and are optional. |
| 21 | If input is paired and there is only one output file, it will be written interleaved. |
| 22 | |
| 23 | Parameters: |
| 24 | ow=f (overwrite) Overwrites files that already exist. |
| 25 | int=f (interleaved) Determines whether INPUT file is considered interleaved. |
| 26 | qin=auto ASCII offset for input quality. May be 33 (Sanger), 64 (Illumina), or auto. |
| 27 | qout=auto ASCII offset for output quality. May be 33 (Sanger), 64 (Illumina), or auto (same as input). |
| 28 | add Add adapters to input files. Default mode. |
| 29 | grade Evaluate trimmed input files. |
| 30 | adapters=<file> Fasta file of adapter sequences. |
| 31 | literal=<sequence> Comma-delimited list of adapter sequences. |
| 32 | left Adapters are on the left (3') end of the read. |
| 33 | right Adapters are on the right (5') end of the read. Default mode. |
| 34 | adderrors=t Add errors to adapters based on the quality scores. |
| 35 | addpaired=t Add adapters to the same location for read 1 and read 2. |
| 36 | arc=f Add reverse-complemented adapters as well as forward. |
| 37 | rate=0.5 Add adapters to this fraction of reads. |
| 38 | |
| 39 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 40 | " |
| 41 | } |
| 42 | |
| 43 | #This block allows symlinked shellscripts to correctly set classpath. |
| 44 | pushd . > /dev/null |
| 45 | DIR="${BASH_SOURCE[0]}" |
| 46 | while [ -h "$DIR" ]; do |
| 47 | cd "$(dirname "$DIR")" |
| 48 | DIR="$(readlink "$(basename "$DIR")")" |
| 49 | done |
| 50 | cd "$(dirname "$DIR")" |
| 51 | DIR="$(pwd)/" |
| 52 | popd > /dev/null |
| 53 | |
| 54 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 55 | CP="$DIR""current/" |
| 56 | |
| 57 | z="-Xmx200m" |
| 58 | set=0 |
| 59 | |
| 60 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 61 | usage |
| 62 | exit |
| 63 | fi |
| 64 | |
| 65 | calcXmx () { |
| 66 | source "$DIR""/calcmem.sh" |
| 67 | setEnvironment |
| 68 | parseXmx "$@" |
| 69 | } |
| 70 | calcXmx "$@" |
| 71 | |
| 72 | function addadapters() { |
| 73 | local CMD="java $EA $EOOM $z -cp $CP jgi.AddAdapters $@" |
| 74 | echo $CMD >&2 |
| 75 | eval $CMD |
| 76 | } |
| 77 | |
| 78 | addadapters "$@" |