Skip to content

Commit 12a7c92

Browse files
committed
update doc
1 parent a96c945 commit 12a7c92

File tree

6 files changed

+152
-6
lines changed

6 files changed

+152
-6
lines changed

DESCRIPTION

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ Suggests:
4646
knitr,
4747
BiocStyle,
4848
htmltools,
49-
BSgenome.Hsapiens.UCSC.hg19
49+
BSgenome.Hsapiens.UCSC.hg19,
50+
graphics
5051
VignetteBuilder: knitr

README.Rmd

+46-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ knitr::opts_chunk$set(
2424
* **Load the data**: `ggcoverage` can load BAM, BigWig (.bw), BedGraph files from various NGS data, including WGS, RNA-seq, ChIP-seq, ATAC-seq, et al.
2525
* **Create genome coverage plot**
2626
* **Add annotations**: `ggcoverage` supports six different annotations:
27-
* **Base and amino acid annotaion**: Visualize genome coverage at single-nucleotide level with bases and amino acids.
27+
* **base and amino acid annotaion**: Visualize genome coverage at single-nucleotide level with bases and amino acids.
2828
* **GC annotation**: Visualize genome coverage with GC content
2929
* **gene annotation**: Visualize genome coverage across whole gene
3030
* **transcription annotation**: Visualize genome coverage across different transcripts
3131
* **ideogram annotation**: Visualize the region showing on whole chromosome
3232
* **peak annotation**: Visualize genome coverage and peak identified
3333

34-
`ggcoverage` utilizes `ggplot2` plotting system, so its usage is ggplot2-style!
34+
`ggcoverage` utilizes `ggplot2` plotting system, so its usage is **ggplot2-style**!
3535

3636

3737
## Installation
@@ -188,6 +188,50 @@ track.df <- LoadTrackFile(
188188
head(track.df)
189189
```
190190

191+
#### Default color scheme
192+
For base and amino acid annotation, we have following default color schemes, you can change with `nuc.color` and `aa.color` parameters.
193+
194+
Default color scheme for base annotation is `Clustal-style`, more popular color schemes is available [here](https://www.biostars.org/p/171056/).
195+
```{r base_color_scheme, warning=FALSE, fig.height = 2, fig.width = 6, fig.align = "center"}
196+
# color scheme
197+
nuc.color = c("A" = "#ff2b08", "C" = "#009aff", "G" = "#ffb507", "T" = "#00bc0d")
198+
# create plot
199+
graphics::par(mar = c(1, 5, 1, 1))
200+
graphics::image(
201+
1:length(nuc.color), 1, as.matrix(1:length(nuc.color)),
202+
col = nuc.color,
203+
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
204+
)
205+
graphics::text(1:length(nuc.color), 1, names(nuc.color))
206+
graphics::mtext(
207+
text = "Base", adj = 1, las = 1,
208+
side = 2
209+
)
210+
```
211+
212+
Default color scheme for amino acid annotation is from [Residual colours: a proposal for aminochromography](https://academic.oup.com/peds/article/10/7/743/1593029?login=false):
213+
```{r aa_color_scheme, warning=FALSE, fig.height = 9, fig.width = 10, fig.align = "center"}
214+
aa.color = c(
215+
"D" = "#FF0000", "S" = "#FF2400", "T" = "#E34234", "G" = "#FF8000", "P" = "#F28500",
216+
"C" = "#FFFF00", "A" = "#FDFF00", "V" = "#E3FF00", "I" = "#C0FF00", "L" = "#89318C",
217+
"M" = "#00FF00", "F" = "#50C878", "Y" = "#30D5C8", "W" = "#00FFFF", "H" = "#0F2CB3",
218+
"R" = "#0000FF", "K" = "#4b0082", "N" = "#800080", "Q" = "#FF00FF", "E" = "#8F00FF",
219+
"*" = "#FFC0CB", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF"
220+
)
221+
222+
graphics::par(mar = c(1, 5, 1, 1))
223+
graphics::image(
224+
1:5, 1:5, matrix(1:length(aa.color),nrow=5),
225+
col = rev(aa.color),
226+
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
227+
)
228+
graphics::text(expand.grid(1:5,1:5), names(rev(aa.color)))
229+
graphics::mtext(
230+
text = "Amino acids", adj = 1, las = 1,
231+
side = 2
232+
)
233+
```
234+
191235
#### Add base and amino acid annotation
192236
```{r base_aa_coverage, warning=FALSE, fig.height = 10, fig.width = 12, fig.align = "center"}
193237
ggcoverage(data = track.df, color = "grey", range.position = "out", single.nuc=T, rect.color = "white") +

README.md

+58-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ coverage. It contains three main parts:
1616
- **Create genome coverage plot**
1717
- **Add annotations**: `ggcoverage` supports six different
1818
annotations:
19-
- **Base and amino acid annotaion**: Visualize genome coverage at
19+
- **base and amino acid annotaion**: Visualize genome coverage at
2020
single-nucleotide level with bases and amino acids.
2121
- **GC annotation**: Visualize genome coverage with GC content
2222
- **gene annotation**: Visualize genome coverage across whole gene
@@ -28,7 +28,7 @@ coverage. It contains three main parts:
2828
identified
2929

3030
`ggcoverage` utilizes `ggplot2` plotting system, so its usage is
31-
ggplot2-style!
31+
**ggplot2-style**!
3232

3333
## Installation
3434

@@ -276,6 +276,62 @@ head(track.df)
276276
#> 6 chr4 62474240 62474241 6 tumorA tumorA
277277
```
278278

279+
#### Default color scheme
280+
281+
For base and amino acid annotation, we have following default color
282+
schemes, you can change with `nuc.color` and `aa.color` parameters.
283+
284+
Default color scheme for base annotation is `Clustal-style`, more
285+
popular color schemes is available
286+
[here](https://www.biostars.org/p/171056/).
287+
288+
``` r
289+
# color scheme
290+
nuc.color = c("A" = "#ff2b08", "C" = "#009aff", "G" = "#ffb507", "T" = "#00bc0d")
291+
# create plot
292+
graphics::par(mar = c(1, 5, 1, 1))
293+
graphics::image(
294+
1:length(nuc.color), 1, as.matrix(1:length(nuc.color)),
295+
col = nuc.color,
296+
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
297+
)
298+
graphics::text(1:length(nuc.color), 1, names(nuc.color))
299+
graphics::mtext(
300+
text = "Base", adj = 1, las = 1,
301+
side = 2
302+
)
303+
```
304+
305+
<img src="man/figures/README-base_color_scheme-1.png" width="100%" style="display: block; margin: auto;" />
306+
307+
Default color scheme for amino acid annotation is from [Residual
308+
colours: a proposal for
309+
aminochromography](https://academic.oup.com/peds/article/10/7/743/1593029?login=false):
310+
311+
``` r
312+
aa.color = c(
313+
"D" = "#FF0000", "S" = "#FF2400", "T" = "#E34234", "G" = "#FF8000", "P" = "#F28500",
314+
"C" = "#FFFF00", "A" = "#FDFF00", "V" = "#E3FF00", "I" = "#C0FF00", "L" = "#89318C",
315+
"M" = "#00FF00", "F" = "#50C878", "Y" = "#30D5C8", "W" = "#00FFFF", "H" = "#0F2CB3",
316+
"R" = "#0000FF", "K" = "#4b0082", "N" = "#800080", "Q" = "#FF00FF", "E" = "#8F00FF",
317+
"*" = "#FFC0CB", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF"
318+
)
319+
320+
graphics::par(mar = c(1, 5, 1, 1))
321+
graphics::image(
322+
1:5, 1:5, matrix(1:length(aa.color),nrow=5),
323+
col = rev(aa.color),
324+
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
325+
)
326+
graphics::text(expand.grid(1:5,1:5), names(rev(aa.color)))
327+
graphics::mtext(
328+
text = "Amino acids", adj = 1, las = 1,
329+
side = 2
330+
)
331+
```
332+
333+
<img src="man/figures/README-aa_color_scheme-1.png" width="100%" style="display: block; margin: auto;" />
334+
279335
#### Add base and amino acid annotation
280336

281337
``` r
5.79 KB
Loading
1.3 KB
Loading

vignettes/ggcoverage.Rmd

+46-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Once `ggcoverage` is installed, it can be loaded by the following command.
5555

5656
```{r library, message=FALSE, warning=FALSE}
5757
library("rtracklayer")
58+
library("graphics")
5859
library("ggcoverage")
5960
```
6061

@@ -73,7 +74,7 @@ library("ggcoverage")
7374
* **ideogram annotation**: Visualize the region showing on whole chromosome
7475
* **peak annotation**: Visualize genome coverage and peak identified
7576

76-
`ggcoverage` utilizes `ggplot2` plotting system, so its usage is ggplot2-style!
77+
`ggcoverage` utilizes `ggplot2` plotting system, so its usage is **ggplot2-style**!
7778

7879
-------------
7980

@@ -219,6 +220,50 @@ track.df <- LoadTrackFile(
219220
head(track.df)
220221
```
221222

223+
### Default color scheme
224+
For base and amino acid annotation, we have following default color schemes, you can change with `nuc.color` and `aa.color` parameters.
225+
226+
Default color scheme for base annotation is `Clustal-style`, more popular color schemes is available [here](https://www.biostars.org/p/171056/).
227+
```{r base_color_scheme, warning=FALSE, fig.height = 2, fig.width = 6, fig.align = "center"}
228+
# color scheme
229+
nuc.color = c("A" = "#ff2b08", "C" = "#009aff", "G" = "#ffb507", "T" = "#00bc0d")
230+
# create plot
231+
graphics::par(mar = c(1, 5, 1, 1))
232+
graphics::image(
233+
1:length(nuc.color), 1, as.matrix(1:length(nuc.color)),
234+
col = nuc.color,
235+
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
236+
)
237+
graphics::text(1:length(nuc.color), 1, names(nuc.color))
238+
graphics::mtext(
239+
text = "Base", adj = 1, las = 1,
240+
side = 2
241+
)
242+
```
243+
244+
Default color scheme for amino acid annotation is from [Residual colours: a proposal for aminochromography](https://academic.oup.com/peds/article/10/7/743/1593029?login=false):
245+
```{r aa_color_scheme, warning=FALSE, fig.height = 9, fig.width = 10, fig.align = "center"}
246+
aa.color = c(
247+
"D" = "#FF0000", "S" = "#FF2400", "T" = "#E34234", "G" = "#FF8000", "P" = "#F28500",
248+
"C" = "#FFFF00", "A" = "#FDFF00", "V" = "#E3FF00", "I" = "#C0FF00", "L" = "#89318C",
249+
"M" = "#00FF00", "F" = "#50C878", "Y" = "#30D5C8", "W" = "#00FFFF", "H" = "#0F2CB3",
250+
"R" = "#0000FF", "K" = "#4b0082", "N" = "#800080", "Q" = "#FF00FF", "E" = "#8F00FF",
251+
"*" = "#FFC0CB", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF"
252+
)
253+
254+
graphics::par(mar = c(1, 5, 1, 1))
255+
graphics::image(
256+
1:5, 1:5, matrix(1:length(aa.color),nrow=5),
257+
col = rev(aa.color),
258+
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
259+
)
260+
graphics::text(expand.grid(1:5,1:5), names(rev(aa.color)))
261+
graphics::mtext(
262+
text = "Amino acids", adj = 1, las = 1,
263+
side = 2
264+
)
265+
```
266+
222267
### Add base and amino acid annotation
223268
```{r base_aa_coverage, warning=FALSE, fig.height = 10, fig.width = 12, fig.align = "center"}
224269
ggcoverage(data = track.df, color = "grey", range.position = "out", single.nuc=T, rect.color = "white") +

0 commit comments

Comments
 (0)