Skip to content

Commit

Permalink
rich text
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkim1210 committed Mar 1, 2024
1 parent 8365c33 commit 95cd793
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SnpArrays = "4e780e97-f5bf-4111-9dc4-b70aaf691b06"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
CairoMakie = "0.11"
DataFrames = "1"
Distributions = "0.25"
Makie = "0.20"
Expand Down
16 changes: 8 additions & 8 deletions docs/src/examples/genes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set_theme!(font = "Arial")

gene = "CACNA1G"
chr, start, stop = GeneticsMakie.findgene(gene, gencode)
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
ranges = [start - 1e5, stop + 1e5]
rs = GeneticsMakie.plotgenes!(ax, chr, ranges[1], ranges[2], gencode)
Expand All @@ -36,7 +36,7 @@ f

We can adjust the height of exons using the `height` keyword argument.
```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, chr, ranges[1], ranges[2], gencode; height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, ranges[1], ranges[2])
Expand All @@ -48,7 +48,7 @@ f

We can change the color of genes and text using the `genecolor` and `textcolor` keyword arguments, respectively.
```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, chr, ranges[1], ranges[2], gencode; height = 0.1, genecolor = :mediumorchid3, textcolor = :forestgreen)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, ranges[1], ranges[2])
Expand All @@ -61,7 +61,7 @@ f
Alternatively, we can visualize this locus by passing `gene` as a positional argument and
`window` as a keyword argument.
```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, gene, gencode; window = 1e5, height = 0.1, genecolor = :brown3)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, ranges[1], ranges[2])
Expand All @@ -74,7 +74,7 @@ f
There is no limit to the number of genes we can visualize. Below we visualize a larger
± 2 Mb window around `gene`.
```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, gene, gencode; window = 2e6, height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, start - 2e6, stop + 2e6)
Expand All @@ -96,7 +96,7 @@ by certain properties such as those that are protein coding or those that are
significant in some sort of gene-level association.

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, chr, start, (gene, :brown3), gencode; window = 1e5, height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, start - 1e5, start + 1e5)
Expand All @@ -107,7 +107,7 @@ f
![](../figs/CACNA1G-gene-highlight.png)

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, chr, start, ([gene, "EPN3"], [:brown3, :forestgreen]), gencode; window = 1e5, height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, start - 1e5, start + 1e5)
Expand All @@ -121,7 +121,7 @@ Finally, we can make additional modifications on top of the figure as needed usi
[__Makie.jl__](https://makie.juliaplots.org/stable/).

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs = GeneticsMakie.plotgenes!(ax, chr, start, gencode; window = 1e5, height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, start - 1e5, start + 1e5)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/gtf.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ gencode = CSV.read("data/gencode/$(file)", DataFrame; delim = "\t", comment = "#
GRCh37 genomic coordinates. Make sure to use the matching human genome build when
visualizing your results.

The ninth column of a [GTF file](https://uswest.ensembl.org/info/website/upload/gff.html)
The ninth column of a [GTF file](https://www.gencodegenes.org/pages/data_format.html)
contains rich information about features, so we can parse this column.
```julia
GeneticsMakie.parsegtf!(gencode)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/examples/gwas.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ titles = ["Height (Yengo et al. 2018)", "Weight (Yengo et al. 2018)"]
```

```julia
f = Figure(resolution = (408, 792))
f = Figure(size = (408, 792))
axs = [Axis(f[i, 1]) for i in 1:length(titles)]
for i in eachindex(titles)
GeneticsMakie.plotgwas!(axs[i], dfs[i])
Expand Down Expand Up @@ -55,7 +55,7 @@ f
We can color even and odd chromosomes with different colors by using the `chromcolors` keyword argument.

```julia
f = Figure(resolution = (408, 792))
f = Figure(size = (408, 792))
axs = [Axis(f[i, 1]) for i in 1:length(titles)]
for i in eachindex(titles)
GeneticsMakie.plotgwas!(axs[i], dfs[i]; linecolor = nothing, scattercolor = nothing,
Expand All @@ -73,7 +73,7 @@ f

We can then use `GeneticsMakie.plotqq!` to draw QQ plots.
```julia
f = Figure(resolution = (408, 792))
f = Figure(size = (408, 792))
axs = [Axis(f[2, i]) for i in 1:length(titles)]
for i in eachindex(titles)
GeneticsMakie.plotqq!(axs[i], dfs[i]; ystep = 5)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/examples/isoforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ isdir("figs") || mkdir("figs")
set_theme!(font = "Arial")

gene = "NRXN1"
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs, chr, range1, range2 = GeneticsMakie.plotisoforms!(ax, gene, gencode; height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, range1, range2)
Expand All @@ -32,7 +32,7 @@ f
To save some space, we can plot the isoform labels on the left by using the `text` keyword argument.

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs, chr, range1, range2 = GeneticsMakie.plotisoforms!(ax, gene, gencode; height = 0.1, text = :l)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, range1, range2)
Expand All @@ -47,7 +47,7 @@ We look at a different gene, _GRIN2A_.

```julia
gene = "GRIN2A"
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs, chr, range1, range2 = GeneticsMakie.plotisoforms!(ax, gene, gencode; isoformcolor = :forestgreen, height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, range1, range2)
Expand All @@ -60,7 +60,7 @@ f
We can change the order of isoforms by using the `orderby` keyword argument.

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs, chr, range1, range2 = GeneticsMakie.plotisoforms!(ax, gene, gencode; orderby = ["ENST00000675189", "ENST00000463531"], isoformcolor = :forestgreen, height = 0.1)
GeneticsMakie.labelgenome(f[1, 1, Bottom()], chr, range1, range2)
Expand All @@ -71,7 +71,7 @@ f
![](../figs/GRIN2A-isoform-order.png)

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
ax = Axis(f[1, 1])
rs, chr, range1, range2 = GeneticsMakie.plotisoforms!(ax, gene, gencode; orderby = ["ENST00000675189", "ENST00000463531"],
highlight = (["ENST00000675398", "ENST00000562109"], fill(:brown3, 2)), isoformcolor = :forestgreen, height = 0.1)
Expand Down
12 changes: 6 additions & 6 deletions docs/src/examples/locus.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ranges = [start - 1e6, stop + 1e6]

n = length(dfs)
titles = ["Height (Yengo et al. 2018)", "Weight (Yengo et al. 2018)"]
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
axs = [Axis(f[i, 1]) for i in 1:(n + 1)]
for i in 1:n
GeneticsMakie.plotlocus!(axs[i], chr, ranges[1], ranges[2], dfs[i])
Expand All @@ -43,7 +43,7 @@ Colorbar(f[1:n, 2], limits = (0, 1), ticks = 0:1:1, height = 20,
colormap = [:gray60, :red2], label = "LD", ticksize = 0, tickwidth = 0,
tickalign = 0, ticklabelsize = 6, flip_vertical_label = true,
labelsize = 6, width = 5, spinewidth = 0.5)
Label(f[1:n, 0], text = "-log[p]", fontsize = 6, rotation = pi / 2)
Label(f[1:n, 0], rich("-log", subscript("10"), rich("P", font = :italic)), fontsize = 6, rotation = pi / 2)
rowgap!(f.layout, 5)
colgap!(f.layout, 5)
for i in 1:(n + 1)
Expand Down Expand Up @@ -73,7 +73,7 @@ kgp = SnpData("data/1kg/kgp.chr15")
We can then color variants by LD with the index/sentinel SNP by using the `ld` keyword argument.

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
axs = [Axis(f[i, 1]) for i in 1:(n + 1)]
for i in 1:n
GeneticsMakie.plotlocus!(axs[i], chr, ranges[1], ranges[2], dfs[i]; ld = kgp)
Expand All @@ -88,7 +88,7 @@ Colorbar(f[1:n, 2], limits = (0, 1), ticks = 0:1:1, height = 20,
colormap = [:gray60, :red2], label = "LD", ticksize = 0, tickwidth = 0,
tickalign = 0, ticklabelsize = 6, flip_vertical_label = true,
labelsize = 6, width = 5, spinewidth = 0.5)
Label(f[1:n, 0], text = "-log[p]", fontsize = 6, rotation = pi / 2)
Label(f[1:n, 0], rich("-log", subscript("10"), rich("P", font = :italic)), fontsize = 6, rotation = pi / 2)
rowgap!(f.layout, 5)
colgap!(f.layout, 5)
for i in 1:(n + 1)
Expand All @@ -103,7 +103,7 @@ f
We can also color variants by LD with the same SNP by using the `ld` keyword argument.

```julia
f = Figure(resolution = (306, 792))
f = Figure(size = (306, 792))
axs = [Axis(f[i, 1]) for i in 1:(n + 1)]
for i in 1:n
GeneticsMakie.plotlocus!(axs[i], chr, ranges[1], ranges[2], dfs[i]; ld = (kgp, ("15", 89395626)))
Expand All @@ -118,7 +118,7 @@ Colorbar(f[1:n, 2], limits = (0, 1), ticks = 0:1:1, height = 20,
colormap = [:gray60, :red2], label = "LD", ticksize = 0, tickwidth = 0,
tickalign = 0, ticklabelsize = 6, flip_vertical_label = true,
labelsize = 6, width = 5, spinewidth = 0.5)
Label(f[1:n, 0], text = "-log[p]", fontsize = 6, rotation = pi / 2)
Label(f[1:n, 0], rich("-log", subscript("10"), rich("P", font = :italic)), fontsize = 6, rotation = pi / 2)
rowgap!(f.layout, 5)
colgap!(f.layout, 5)
for i in 1:(n + 1)
Expand Down
Binary file modified docs/src/figs/ACAN-locuszoom-ld-snp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/figs/ACAN-locuszoom-ld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/figs/ACAN-locuszoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/plotgwas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function plotgwas!(
hideydecorations!(ax, label = false, ticklabels = false, ticks = false)
hidexdecorations!(ax, label = false, ticklabels = false)
ax.xlabel = "Chromosome"
ax.ylabel = "-log[p]"
ax.ylabel = rich("-log", subscript("10"), rich("P", font = :italic))
ax.xticks = ((cumsum(storage.maxpos) + storage.add) / 2, storage.CHR)
ax.yticks = setticks(ymax)
ax.xticklabelsize = 6
Expand Down
4 changes: 2 additions & 2 deletions src/plotqq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function plotqq!(
ylims!(ax, 0, ymax)
hidedecorations!(ax, label = false, ticklabels = false, ticks = false)
ax.aspect = AxisAspect(1)
ax.xlabel = "Expected -log[p]"
ax.ylabel = "Observed -log[p]"
ax.xlabel = rich("Expected -log", subscript("10"), rich("P", font = :italic))
ax.ylabel = rich("Observed -log", subscript("10"), rich("P", font = :italic))
ax.xticklabelsize = 6
ax.yticklabelsize = 6
ax.xlabelsize = 8
Expand Down

0 comments on commit 95cd793

Please sign in to comment.