| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified July 10, 2023 |
| 7 | |
| 8 | Description: Reads the entire file to find extended information about the format and contents. |
| 9 | |
| 10 | Usage: testformat2.sh <file> |
| 11 | |
| 12 | |
| 13 | Parameters: |
| 14 | |
| 15 | full=t Process the full file. |
| 16 | speed=f Print processing time. |
| 17 | |
| 18 | printjunk=f Print headers of junk reads to stdout. |
| 19 | zmw=t Parse PacBio ZMW IDs. |
| 20 | |
| 21 | barcodelist= Optional list of expected barcodes. May be a filename |
| 22 | with one line per barcode, or a comma-delimited literal. |
| 23 | printbarcodes=f Print barcodes and counts to stdout. |
| 24 | edist=f Calculate barcode edit distance. |
| 25 | |
| 26 | printqhist=f Print quality histogram to stdout. |
| 27 | printihist=f Print insert size histogram to stdout. |
| 28 | |
| 29 | bhistlen=10k bhist.txt will be calculated from reads up to this length. |
| 30 | To allow all reads, set to 0. |
| 31 | |
| 32 | merge=t Calculate mergability via BBMerge. |
| 33 | sketch=t (card) Calculate cardinality via BBSketch. |
| 34 | If enabled, also sends the sketch to the refseq server. |
| 35 | trim=t Calculate trimmability from quality. |
| 36 | |
| 37 | File output parameters (these can be eliminated by setting to null): |
| 38 | |
| 39 | junk=junk.txt Print headers of junk reads to this file. |
| 40 | barcodes=barcodes.txt Print barcodes to this file. |
| 41 | |
| 42 | hist=t False will clear all default histogram files. |
| 43 | qhist=qhist.txt Print quality histogram to this file. |
| 44 | ihist=ihist.txt Print insert size histogram to this file. |
| 45 | khist=khist.txt Print kmer frequency histogram to this file. |
| 46 | bhist=bhist.txt Print base composition histogram to this file. |
| 47 | lhist=lhist.txt Print length histogram to this file. |
| 48 | gchist=gchist.txt Print gc histogram to this file. |
| 49 | zmwhist=zmwhist.txt Print ZMW pass count histogram to this file. |
| 50 | |
| 51 | |
| 52 | Terminology: |
| 53 | |
| 54 | Format File format, e.g. fastq. |
| 55 | Compression Compression format, e.g. gz. |
| 56 | Interleaved True if reads are paired in a single file. |
| 57 | MaxLen Maximum observed read length. |
| 58 | MinLen Minimum observed read length. |
| 59 | StdevLen Standard deviation of observed read lengths. |
| 60 | ModeLen Mode of observed read lengths. |
| 61 | QualOffset Quality score offset. |
| 62 | NegativeQuals Number of bases with negative quality scores. |
| 63 | |
| 64 | Content Nucleotides or AminoAcids. |
| 65 | Type RNA, DNA, or Mixed. |
| 66 | Reads Number of reads processed. |
| 67 | -JunkReads Reads with invalid bases or other problems. |
| 68 | -ChastityFail Reads failing Illumina's chastity filter. |
| 69 | -BadPairNames Read pairs whose names don't match. |
| 70 | |
| 71 | Bases Number of bases processed. |
| 72 | -Lowercase Lowercase bases. |
| 73 | -Uppercase Uppercase bases. |
| 74 | -Non-Letter Non-letter symbols in bases. |
| 75 | -FullyDefined A, C, G, T, or U bases. |
| 76 | -No-call N bases. |
| 77 | -Degenerate Non-ACGTUN valid IUPAC symbols. |
| 78 | -Gap - symbol. |
| 79 | -Invalid Symbols that are not valid characters for sequence. |
| 80 | |
| 81 | GC GC content: (C+G)/(C+G+A+T+U). |
| 82 | Cardinality Approximate number of unique 31-mers in the file. |
| 83 | Organism Taxonomic name of top hit from BBSketch RefSeq server. |
| 84 | TaxID TaxID from BBSketch. |
| 85 | Barcodes Number of observed barcodes (for Illumina). |
| 86 | ZMWs Number of observed ZMWs (for PacBio). |
| 87 | |
| 88 | Mergable Fraction of read pairs that appear to overlap. |
| 89 | -InsertMean Average insert size, from merging. |
| 90 | -InsertMode Insert size mode from, merging. |
| 91 | -AdapterReads Fraction of reads with adapter sequence, from merging. |
| 92 | -AdapterBases Fraction of bases that are adapter sequence, from merging. |
| 93 | |
| 94 | QErrorRate Average error rate from quality scores. |
| 95 | -QAvgLog Logarithmic average quality score. |
| 96 | -QAvgLinear Linear average quality score. |
| 97 | -TrimmedAtQ5 Fraction of bases trimmed at Q5. |
| 98 | -TrimmedAtQ10 Fraction of bases trimmed at Q10. |
| 99 | -TrimmedAtQ15 Fraction of bases trimmed at Q15. |
| 100 | -TrimmedAtQ20 Fraction of bases trimmed at Q20. |
| 101 | |
| 102 | Qhist Quality score histogram, one line per observed quality bin. |
| 103 | Ihist Insert size histogram, based on pair merging. |
| 104 | BarcodeList List of observed barcodes. |
| 105 | JunkList List of headers of problematic reads. |
| 106 | |
| 107 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 108 | " |
| 109 | } |
| 110 | |
| 111 | #This block allows symlinked shellscripts to correctly set classpath. |
| 112 | pushd . > /dev/null |
| 113 | DIR="${BASH_SOURCE[0]}" |
| 114 | while [ -h "$DIR" ]; do |
| 115 | cd "$(dirname "$DIR")" |
| 116 | DIR="$(readlink "$(basename "$DIR")")" |
| 117 | done |
| 118 | cd "$(dirname "$DIR")" |
| 119 | DIR="$(pwd)/" |
| 120 | popd > /dev/null |
| 121 | |
| 122 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 123 | CP="$DIR""current/" |
| 124 | |
| 125 | z="-Xmx2g" |
| 126 | z2="-Xms2g" |
| 127 | set=0 |
| 128 | |
| 129 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 130 | usage |
| 131 | exit |
| 132 | fi |
| 133 | |
| 134 | calcXmx () { |
| 135 | source "$DIR""/calcmem.sh" |
| 136 | setEnvironment |
| 137 | parseXmx "$@" |
| 138 | if [[ $set == 1 ]]; then |
| 139 | return |
| 140 | fi |
| 141 | freeRam 2000m 42 |
| 142 | z="-Xmx${RAM}m" |
| 143 | z2="-Xms${RAM}m" |
| 144 | } |
| 145 | calcXmx "$@" |
| 146 | |
| 147 | testformat() { |
| 148 | local CMD="java $EA $EOOM $z -cp $CP jgi.TestFormat $@" |
| 149 | # echo $CMD >&2 |
| 150 | eval $CMD |
| 151 | } |
| 152 | |
| 153 | testformat "$@" |