Skip to content

Commit

Permalink
Merge pull request #120 from stemangiola/distance-methods
Browse files Browse the repository at this point in the history
add distance to README
  • Loading branch information
stemangiola authored Jul 19, 2023
2 parents 7284aa3 + 025a368 commit 68db595
Show file tree
Hide file tree
Showing 57 changed files with 266 additions and 135 deletions.
75 changes: 49 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,37 @@ mtcars_heatmap <-
mtcars_heatmap
```

![](man/fragments/figures/unnamed-chunk-7-1.png)<!-- -->
![](man/fragments/figures/heatmap-1.png)<!-- -->

## Saving

``` r
mtcars_heatmap |> save_pdf("mtcars_heatmap.pdf")
```

## Clustering

Choose alternative clustering distance and methods.

``` r
tidyHeatmap::pasilla |>

heatmap(
.column = sample,
.row = symbol,
.value = `count normalised adjusted`,
scale = "row",

# Arguments passed to ComplexHeatmap
clustering_distance_rows = "manhattan",
clustering_distance_columns = "manhattan",
clustering_method_rows = "ward.D",
clustering_method_columns = "ward.D"
)
```

![](man/fragments/figures/distance-1.png)<!-- -->

## Grouping and splitting

We can easily group the data (one group per dimension maximum, at the
Expand All @@ -187,7 +210,7 @@ mtcars_tidy_groupings |>
annotation_tile(hp)
```

![](man/fragments/figures/unnamed-chunk-9-1.png)<!-- -->
![](man/fragments/figures/grouping-1.png)<!-- -->

We can provide colour palettes to groupings

Expand All @@ -209,7 +232,7 @@ mtcars_tidy_groupings |>
annotation_tile(hp)
```

![](man/fragments/figures/unnamed-chunk-10-1.png)<!-- -->
![](man/fragments/figures/grouping2-1.png)<!-- -->

We can split based on the cladogram

Expand All @@ -220,7 +243,7 @@ mtcars_tidy |>
split_columns(2)
```

![](man/fragments/figures/unnamed-chunk-11-1.png)<!-- -->
![](man/fragments/figures/split-1.png)<!-- -->

We can split on kmean clustering (using ComplexHeatmap options, it is
stochastic)
Expand All @@ -235,7 +258,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-12-1.png)<!-- -->
![](man/fragments/figures/split2-1.png)<!-- -->

## Custom palettes

Expand All @@ -253,7 +276,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-13-1.png)<!-- -->
![](man/fragments/figures/custom-1.png)<!-- -->

A better-looking blue-to-red palette

Expand All @@ -271,7 +294,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-14-1.png)<!-- -->
![](man/fragments/figures/redblue-1.png)<!-- -->

Or a grid::colorRamp2 function for higher flexibility

Expand All @@ -286,7 +309,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-15-1.png)<!-- -->
![](man/fragments/figures/flexible-1.png)<!-- -->

We can use custom colors for tile annotation

Expand All @@ -310,7 +333,7 @@ mtcars_tidy |>
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

![](man/fragments/figures/unnamed-chunk-16-1.png)<!-- -->
![](man/fragments/figures/customtile-1.png)<!-- -->

We can use grid::colorRamp2 function for tile annotation for specific
color scales
Expand All @@ -329,7 +352,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-17-1.png)<!-- -->
![](man/fragments/figures/customtile2-1.png)<!-- -->

## Multiple groupings and annotations

Expand All @@ -346,7 +369,7 @@ tidyHeatmap::pasilla |>
annotation_tile(activation)
```

![](man/fragments/figures/unnamed-chunk-18-1.png)<!-- -->
![](man/fragments/figures/multiple-1.png)<!-- -->

Remove legends, adding aesthetics to annotations in a modular fashion,
using `ComplexHeatmap` arguments
Expand All @@ -365,7 +388,7 @@ tidyHeatmap::pasilla |>
annotation_tile(activation, show_legend = FALSE)
```

![](man/fragments/figures/unnamed-chunk-19-1.png)<!-- -->
![](man/fragments/figures/nolegend-1.png)<!-- -->

## Annotation types

Expand Down Expand Up @@ -396,7 +419,7 @@ pasilla_plus |>
annotation_line(age)
```

![](man/fragments/figures/unnamed-chunk-20-1.png)<!-- -->
![](man/fragments/figures/manyannotations-1.png)<!-- -->

## Annotation size

Expand All @@ -418,7 +441,7 @@ pasilla_plus |>
annotation_line(age, size = unit(0.3, "cm"), annotation_name_gp= gpar(fontsize = 8))
```

![](man/fragments/figures/unnamed-chunk-21-1.png)<!-- -->
![](man/fragments/figures/size-1.png)<!-- -->

# Layer symbol

Expand Down Expand Up @@ -452,7 +475,7 @@ tidyHeatmap::pasilla |>
)
```

![](man/fragments/figures/unnamed-chunk-22-1.png)<!-- -->
![](man/fragments/figures/layer-1.png)<!-- -->

# Layer text

Expand Down Expand Up @@ -486,7 +509,7 @@ tidyHeatmap::pasilla |>
)
```

![](man/fragments/figures/unnamed-chunk-23-1.png)<!-- -->
![](man/fragments/figures/layertext-1.png)<!-- -->

# Adding heatmap side-by-side

Expand All @@ -496,7 +519,7 @@ p_heatmap = heatmap(mtcars_tidy, `Car name`, Property, Value, scale = "row")
p_heatmap + p_heatmap
```

![](man/fragments/figures/unnamed-chunk-24-1.png)<!-- -->
![](man/fragments/figures/sidebyside-1.png)<!-- -->

# ComplexHeatmap further styling

Expand All @@ -511,7 +534,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-25-1.png)<!-- -->
![](man/fragments/figures/borders-1.png)<!-- -->

## Drop row clustering

Expand All @@ -524,7 +547,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-26-1.png)<!-- -->
![](man/fragments/figures/droprow-1.png)<!-- -->

## Reorder rows elements

Expand All @@ -539,7 +562,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-27-1.png)<!-- -->
![](man/fragments/figures/reorder-1.png)<!-- -->

## Size of dendrograms

Expand All @@ -554,7 +577,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-28-1.png)<!-- -->
![](man/fragments/figures/sizedendro-1.png)<!-- -->

## Size of rows/columns titles and names

Expand All @@ -571,7 +594,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-29-1.png)<!-- -->
![](man/fragments/figures/sizecolumns-1.png)<!-- -->

## External `ComplexHeatmap` functionalities

Expand All @@ -587,7 +610,7 @@ heatmap(mtcars_tidy, `Car name`, Property, Value, scale = "row" ) %>%
ComplexHeatmap::draw(heatmap_legend_side = "left" )
```

![](man/fragments/figures/unnamed-chunk-30-1.png)<!-- -->
![](man/fragments/figures/sidelegend-1.png)<!-- -->

### Add title using `draw` from `ComplexHeatmap`

Expand All @@ -601,7 +624,7 @@ mtcars_tidy |>
)
```

![](man/fragments/figures/unnamed-chunk-31-1.png)<!-- -->
![](man/fragments/figures/title-1.png)<!-- -->

## Using patchwork to integrate heatmaps

Expand Down Expand Up @@ -632,7 +655,7 @@ wrap_heatmap(p_heatmap) +
plot_layout(width = c(1, 0.3, 1))
```

![](man/fragments/figures/unnamed-chunk-32-1.png)<!-- -->
![](man/fragments/figures/patchworkintegrate-1.png)<!-- -->

### Add title using `ggtitle` from `ggplot2`

Expand All @@ -643,4 +666,4 @@ mtcars_tidy |>
ggplot2::ggtitle("TITLE")
```

![](man/fragments/figures/unnamed-chunk-33-1.png)<!-- -->
![](man/fragments/figures/title2-1.png)<!-- -->
Binary file added man/fragments/figures/borders-1.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 added man/fragments/figures/custom-1.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 added man/fragments/figures/customtile-1.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 added man/fragments/figures/customtile2-1.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 added man/fragments/figures/distance-1.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 added man/fragments/figures/droprow-1.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 added man/fragments/figures/flexible-1.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 added man/fragments/figures/grouping-1.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 added man/fragments/figures/grouping2-1.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 added man/fragments/figures/heatmap-1.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 added man/fragments/figures/layer-1.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 added man/fragments/figures/layertext-1.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 added man/fragments/figures/manyannotations-1.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 added man/fragments/figures/multiple-1.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 added man/fragments/figures/nolegend-1.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 added man/fragments/figures/patchworkintegrate-1.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 added man/fragments/figures/redblue-1.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 added man/fragments/figures/reorder-1.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 added man/fragments/figures/sidebyside-1.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 added man/fragments/figures/sidelegend-1.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 added man/fragments/figures/size-1.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 added man/fragments/figures/sizecolumns-1.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 added man/fragments/figures/sizedendro-1.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 added man/fragments/figures/split-1.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 added man/fragments/figures/split2-1.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 added man/fragments/figures/title-1.png
Binary file added man/fragments/figures/title2-1.png
Binary file removed man/fragments/figures/unnamed-chunk-10-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-11-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-12-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-13-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-14-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-15-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-16-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-17-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-18-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-19-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-20-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-21-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-22-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-23-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-24-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-25-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-26-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-27-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-28-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-29-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-30-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-31-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-31-2.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-32-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-33-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-7-1.png
Diff not rendered.
Binary file removed man/fragments/figures/unnamed-chunk-9-1.png
Diff not rendered.
Loading

0 comments on commit 68db595

Please sign in to comment.