https://github.com/alserglab/mascarade

Generate masks for scRNA-seq clusters on t-SNE or UMAP plots

https://github.com/alserglab/mascarade

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.8%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Generate masks for scRNA-seq clusters on t-SNE or UMAP plots

Basic Info
  • Host: GitHub
  • Owner: alserglab
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 103 KB
Statistics
  • Stars: 26
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog

README.Rmd

---
output: github_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# mascarade

`mascarade` package implements a procedure to automatically generate 2D masks
for clusters on single-cell dimensional reduction plots like t-SNE or UMAP.

See the [tutorial](https://rpubs.com/asergushichev/mascarade-tutorial) for usage details
and [gallery](https://rpubs.com/asergushichev/mascarade-gallery) for examples 
on different datasets.


## Installation

The package can be installed from GitHub:

```{r eval=FALSE}
remotes::install_github("alserglab/mascarade")
```

## Quick run

Loading neccessary libraries:

```{r}
library(mascarade)
library(ggplot2)
library(data.table)
```

Loading example data:

```{r}
data("exampleMascarade")
```

Generating masks:

```{r}
maskTable <- generateMask(dims=exampleMascarade$dims, 
                          clusters=exampleMascarade$clusters)
```

Plotting with `ggplot2`:

```{r readme-basic, fig.show="hide"}
data <- data.table(exampleMascarade$dims, 
                   cluster=exampleMascarade$clusters,
                   exampleMascarade$features)

ggplot(data, aes(x=UMAP_1, y=UMAP_2)) + 
    geom_point(aes(color=cluster)) + 
    geom_path(data=maskTable, aes(group=group)) +
    coord_fixed() + 
    theme_classic()
```



Fancy version, showing NGLY gene being specific to NK cells:

```{r readme-fancy, fig.show="hide"}
library(ggforce)
library(ggnewscale)
fancyMask <- list(
    ggforce::geom_shape(data=maskTable, aes(group=group, color=cluster),
               linewidth=1, fill=NA, expand=unit(-1, "pt"), show.legend = FALSE),
    ggforce::geom_mark_hull(data=maskTable, fill = NA, aes(group=cluster, color=cluster, label = cluster),
                   linewidth=0,
                   radius=0, expand=0, con.cap=0, con.type = "straight",
                   label.fontsize = 10, label.buffer = unit(0, "cm"),
                   label.fontface = "plain",
                   label.minwidth = 0,
                   label.margin = margin(2, 2, 2, 2, "pt"),
                   label.lineheight = 0,
                   con.colour = "inherit",
                   show.legend = FALSE),
    # expanding to give a bit more space for labels
    scale_x_continuous(expand = expansion(mult = 0.1)),
    scale_y_continuous(expand = expansion(mult = 0.1))
)
ggplot(data, aes(x=UMAP_1, y=UMAP_2)) + 
    geom_point(aes(color=GNLY), size=0.5) +
    scale_color_gradient2(low = "#404040", high="red") + 
    new_scale_color() + 
    fancyMask +
    coord_fixed() + 
    theme_classic()
```


Owner

  • Name: alserglab
  • Login: alserglab
  • Kind: organization

GitHub Events

Total
  • Watch event: 27
  • Push event: 6
  • Fork event: 1
  • Create event: 2
Last Year
  • Watch event: 27
  • Push event: 6
  • Fork event: 1
  • Create event: 2