Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
showteeth committed Aug 10, 2022
1 parent a96c945 commit 12a7c92
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ Suggests:
knitr,
BiocStyle,
htmltools,
BSgenome.Hsapiens.UCSC.hg19
BSgenome.Hsapiens.UCSC.hg19,
graphics
VignetteBuilder: knitr
48 changes: 46 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ knitr::opts_chunk$set(
* **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.
* **Create genome coverage plot**
* **Add annotations**: `ggcoverage` supports six different annotations:
* **Base and amino acid annotaion**: Visualize genome coverage at single-nucleotide level with bases and amino acids.
* **base and amino acid annotaion**: Visualize genome coverage at single-nucleotide level with bases and amino acids.
* **GC annotation**: Visualize genome coverage with GC content
* **gene annotation**: Visualize genome coverage across whole gene
* **transcription annotation**: Visualize genome coverage across different transcripts
* **ideogram annotation**: Visualize the region showing on whole chromosome
* **peak annotation**: Visualize genome coverage and peak identified

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


## Installation
Expand Down Expand Up @@ -188,6 +188,50 @@ track.df <- LoadTrackFile(
head(track.df)
```

#### Default color scheme
For base and amino acid annotation, we have following default color schemes, you can change with `nuc.color` and `aa.color` parameters.

Default color scheme for base annotation is `Clustal-style`, more popular color schemes is available [here](https://www.biostars.org/p/171056/).
```{r base_color_scheme, warning=FALSE, fig.height = 2, fig.width = 6, fig.align = "center"}
# color scheme
nuc.color = c("A" = "#ff2b08", "C" = "#009aff", "G" = "#ffb507", "T" = "#00bc0d")
# create plot
graphics::par(mar = c(1, 5, 1, 1))
graphics::image(
1:length(nuc.color), 1, as.matrix(1:length(nuc.color)),
col = nuc.color,
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
graphics::text(1:length(nuc.color), 1, names(nuc.color))
graphics::mtext(
text = "Base", adj = 1, las = 1,
side = 2
)
```

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):
```{r aa_color_scheme, warning=FALSE, fig.height = 9, fig.width = 10, fig.align = "center"}
aa.color = c(
"D" = "#FF0000", "S" = "#FF2400", "T" = "#E34234", "G" = "#FF8000", "P" = "#F28500",
"C" = "#FFFF00", "A" = "#FDFF00", "V" = "#E3FF00", "I" = "#C0FF00", "L" = "#89318C",
"M" = "#00FF00", "F" = "#50C878", "Y" = "#30D5C8", "W" = "#00FFFF", "H" = "#0F2CB3",
"R" = "#0000FF", "K" = "#4b0082", "N" = "#800080", "Q" = "#FF00FF", "E" = "#8F00FF",
"*" = "#FFC0CB", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF"
)
graphics::par(mar = c(1, 5, 1, 1))
graphics::image(
1:5, 1:5, matrix(1:length(aa.color),nrow=5),
col = rev(aa.color),
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
graphics::text(expand.grid(1:5,1:5), names(rev(aa.color)))
graphics::mtext(
text = "Amino acids", adj = 1, las = 1,
side = 2
)
```

#### Add base and amino acid annotation
```{r base_aa_coverage, warning=FALSE, fig.height = 10, fig.width = 12, fig.align = "center"}
ggcoverage(data = track.df, color = "grey", range.position = "out", single.nuc=T, rect.color = "white") +
Expand Down
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ coverage. It contains three main parts:
- **Create genome coverage plot**
- **Add annotations**: `ggcoverage` supports six different
annotations:
- **Base and amino acid annotaion**: Visualize genome coverage at
- **base and amino acid annotaion**: Visualize genome coverage at
single-nucleotide level with bases and amino acids.
- **GC annotation**: Visualize genome coverage with GC content
- **gene annotation**: Visualize genome coverage across whole gene
Expand All @@ -28,7 +28,7 @@ coverage. It contains three main parts:
identified

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

## Installation

Expand Down Expand Up @@ -276,6 +276,62 @@ head(track.df)
#> 6 chr4 62474240 62474241 6 tumorA tumorA
```

#### Default color scheme

For base and amino acid annotation, we have following default color
schemes, you can change with `nuc.color` and `aa.color` parameters.

Default color scheme for base annotation is `Clustal-style`, more
popular color schemes is available
[here](https://www.biostars.org/p/171056/).

``` r
# color scheme
nuc.color = c("A" = "#ff2b08", "C" = "#009aff", "G" = "#ffb507", "T" = "#00bc0d")
# create plot
graphics::par(mar = c(1, 5, 1, 1))
graphics::image(
1:length(nuc.color), 1, as.matrix(1:length(nuc.color)),
col = nuc.color,
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
graphics::text(1:length(nuc.color), 1, names(nuc.color))
graphics::mtext(
text = "Base", adj = 1, las = 1,
side = 2
)
```

<img src="man/figures/README-base_color_scheme-1.png" width="100%" style="display: block; margin: auto;" />

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):

``` r
aa.color = c(
"D" = "#FF0000", "S" = "#FF2400", "T" = "#E34234", "G" = "#FF8000", "P" = "#F28500",
"C" = "#FFFF00", "A" = "#FDFF00", "V" = "#E3FF00", "I" = "#C0FF00", "L" = "#89318C",
"M" = "#00FF00", "F" = "#50C878", "Y" = "#30D5C8", "W" = "#00FFFF", "H" = "#0F2CB3",
"R" = "#0000FF", "K" = "#4b0082", "N" = "#800080", "Q" = "#FF00FF", "E" = "#8F00FF",
"*" = "#FFC0CB", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF"
)

graphics::par(mar = c(1, 5, 1, 1))
graphics::image(
1:5, 1:5, matrix(1:length(aa.color),nrow=5),
col = rev(aa.color),
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
graphics::text(expand.grid(1:5,1:5), names(rev(aa.color)))
graphics::mtext(
text = "Amino acids", adj = 1, las = 1,
side = 2
)
```

<img src="man/figures/README-aa_color_scheme-1.png" width="100%" style="display: block; margin: auto;" />

#### Add base and amino acid annotation

``` r
Expand Down
Binary file added man/figures/README-aa_color_scheme-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-base_color_scheme-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 46 additions & 1 deletion vignettes/ggcoverage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Once `ggcoverage` is installed, it can be loaded by the following command.

```{r library, message=FALSE, warning=FALSE}
library("rtracklayer")
library("graphics")
library("ggcoverage")
```

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

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

-------------

Expand Down Expand Up @@ -219,6 +220,50 @@ track.df <- LoadTrackFile(
head(track.df)
```

### Default color scheme
For base and amino acid annotation, we have following default color schemes, you can change with `nuc.color` and `aa.color` parameters.

Default color scheme for base annotation is `Clustal-style`, more popular color schemes is available [here](https://www.biostars.org/p/171056/).
```{r base_color_scheme, warning=FALSE, fig.height = 2, fig.width = 6, fig.align = "center"}
# color scheme
nuc.color = c("A" = "#ff2b08", "C" = "#009aff", "G" = "#ffb507", "T" = "#00bc0d")
# create plot
graphics::par(mar = c(1, 5, 1, 1))
graphics::image(
1:length(nuc.color), 1, as.matrix(1:length(nuc.color)),
col = nuc.color,
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
graphics::text(1:length(nuc.color), 1, names(nuc.color))
graphics::mtext(
text = "Base", adj = 1, las = 1,
side = 2
)
```

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):
```{r aa_color_scheme, warning=FALSE, fig.height = 9, fig.width = 10, fig.align = "center"}
aa.color = c(
"D" = "#FF0000", "S" = "#FF2400", "T" = "#E34234", "G" = "#FF8000", "P" = "#F28500",
"C" = "#FFFF00", "A" = "#FDFF00", "V" = "#E3FF00", "I" = "#C0FF00", "L" = "#89318C",
"M" = "#00FF00", "F" = "#50C878", "Y" = "#30D5C8", "W" = "#00FFFF", "H" = "#0F2CB3",
"R" = "#0000FF", "K" = "#4b0082", "N" = "#800080", "Q" = "#FF00FF", "E" = "#8F00FF",
"*" = "#FFC0CB", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF", " " = "#FFFFFF"
)
graphics::par(mar = c(1, 5, 1, 1))
graphics::image(
1:5, 1:5, matrix(1:length(aa.color),nrow=5),
col = rev(aa.color),
xlab = "", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
graphics::text(expand.grid(1:5,1:5), names(rev(aa.color)))
graphics::mtext(
text = "Amino acids", adj = 1, las = 1,
side = 2
)
```

### Add base and amino acid annotation
```{r base_aa_coverage, warning=FALSE, fig.height = 10, fig.width = 12, fig.align = "center"}
ggcoverage(data = track.df, color = "grey", range.position = "out", single.nuc=T, rect.color = "white") +
Expand Down

0 comments on commit 12a7c92

Please sign in to comment.