# scripts for read highlighting
## 1. Highlight full construct in reads shorter than expected
```Shell!
GREP_COLORS='mt=01;33' zgrep --color=always "GG\(A\|T\)AC\(A\|T\)GG\(A\|T\)TGAAC\(A\|T\)GT\(A\|T\)TA\(T\|C\)CC\(T\|C\)CC" Undetermined_S0_L001_R1_001.fastq.gz | GREP_COLORS='mt=04;31' grep --color=always "TG\(A\|G\)TT\(T\|C\)TT\(T\|C\)GGTCA\(T\|C\)CCTGA\(A\|G\)GTTTA" | GREP_COLORS='mt=04;35' grep --color=always "ATCTCGTATGCCGTCTTCTGCTTG" | GREP_COLORS='mt=04;38;5;34' grep --color=always "AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC"
```
pipe the following for counting the selected sequences
```bash
wc -l
```
## 2. Extract PCR(1) product
```Bash!
GREP_COLORS='mt=01;33' zgrep --color=always "GG\(A\|T\)AC\(A\|T\)GG\(A\|T\)TGAAC\(A\|T\)GT\(A\|T\)TA\(T\|C\)CC\(T\|C\)CC" Undetermined_S0_L001_R1_001.fastq.gz | GREP_COLORS='mt=04;31' grep --color=always "TG\(A\|G\)TT\(T\|C\)TT\(T\|C\)GGTCA\(T\|C\)CCTGA\(A\|G\)GTTTA" | sed 's/GG\\(A\|T\)AC\(A\|T\)GG\(A\|T\)TGAAC\(A\|T\)GT\(A\|T\)TA\(T\|C\)CC\(T\|C\)CC//g; s/TG\(A\|G\)TT\(T\|C\)TT\(T\|C\)GGTCA\(T\|C\)CCTGA\(A\|G\)GTTTA.*$//g'
```
Pipe the following to extract sequences of specified size (81 in the example)
```bash
awk '{if (length-28 == 81) print}'
```
Pipe the following for a size histogram
```bash!
awk '{print length-28}' | sort -g | uniq -c
```
## 3. Color and Style conversion table
### Styling
```
┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ### ┃ GNOME Terminal ┃ xterm ┃ non-GUI TTY ┃
┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
│ │ «reset style+colors» │ «reset style+colors» │ «reset style+colors» │
│ 0 │ «reset style+colors» │ «reset style+colors» │ «reset style+colors» │
├─────┼─────────────────────────┼─────────────────────────┼───────────────────────┤
│ 1 │ +bold, +brighter color │ +bold, +brighter color │ +brighter color, │
│ │ │ │ -forced grey │
│ 2 │ +fainter color │ +fainter color │ +forced grey │
│ 3 │ +italic │ +italic │ +forced green │
│ │ │ │ ● overrides 2 and 4 │
│ 4 │ +underline │ +underline │ +forced cyan │
│ │ │ │ ● overrides 2 │
│ 5 │ «no effect» │ +blink │ «no effect» │
│ 7 │ +invert colors │ +invert colors │ +invert colors │
│ 8 │ +invisible │ +invisible │ «no effect» │
│ │ │ ● underline appears │ │
│ 9 │ +strikethrough │ +strikethrough │ «no effect» │
├─────┼─────────────────────────┤ ├───────────────────────┤
│ 21 │ -bold, -brighter color, │ +double underline │ -brighter color, │
│ │ -fainter color ├─────────────────────────┤ -forced grey │
│ 22 │ -bold, -brighter color, │ -bold, -brighter color, │ -brighter color, │
│ │ -fainter color │ -fainter color │ -forced grey │
│ 23 │ -italic │ -italic │ -forced green │
│ 24 │ -underline │ -underline, │ -forced cyan │
│ │ │ -double underline │ │
│ 25 │ «no effect» │ -blink │ «no effect» │
│ 27 │ -invert colors │ -invert colors │ -invert colors │
│ 28 │ -invisible │ -invisible │ «no effect» │
│ 29 │ -strikethrough │ -strikethrough │ «no effect» │
└─────┴─────────────────────────┴─────────────────────────┴───────────────────────┘
```
### Coloring
```
┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ### ┃ GNOME Terminal ┃ xterm ┃ non-GUI TTY ┃
┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
│ 39 │ «reset this color» │ «reset this color» │ «reset this color» │
├─────┼─────────────────────────┼─────────────────────────┼───────────────────────┤
│ 30 │ very dark grey │ black │ black │
│ 31 │ dull red │ red │ light red │
│ 32 │ dull green │ light green │ light green │
│ 33 │ dull yellow │ yellow │ yellow │
│ 34 │ greyish blue │ dark blue │ sky blue │
│ 35 │ dull purple │ purple │ purple │
│ 36 │ teal │ cyan │ cyan │
│ 37 │ light grey │ light grey │ light grey │
├─────┼─────────────────────────┼─────────────────────────┼───────────────────────┤
│ 90 │ dark grey │ dull grey │ dull grey │
│ 91 │ red │ bright red │ bright red │
│ 92 │ lime green │ bright green │ bright green │
│ 93 │ yellow │ bright yellow │ pure yellow │
│ 94 │ light greyish blue │ dull blue │ deep blue │
│ 95 │ light purple │ magenta │ magenta │
│ 96 │ cyan │ bright cyan │ bright cyan │
│ 97 │ off white │ white │ white │
├─────┴──────┬──────────────────┴─────────────────────────┴───────────────────────┤
│ 38;2;ʀ;ɢ;ʙ │ replace ʀ, ɢ, and ʙ with RGB values from 0 to 255 │
│ │ for closest supported color (non-GUI TTY has only 16 colors!) │
│ 38;5;ɴ │ replace ɴ with value from 256-color chart below │
│ │ for closest supported color (non-GUI TTY has only 16 colors!) │
└────────────┴────────────────────────────────────────────────────────────────────┘
```