Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make element optional #5

Merged
merged 3 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ library(knitr)
knitr::opts_chunk$set(cache = TRUE, warning = FALSE,
message = FALSE, cache.lazy = FALSE)

library(dplyr)
library(tidygate)

```

It interactively or programmately labels points within custom gates on two dimensions, according to tidyverse principles. The information is added to your tibble. It is based on the package `gatepoints` from Wajid Jawaid.
Expand Down Expand Up @@ -58,3 +61,58 @@ devtools::install_github("stemangiola/tidygate")

```

## Interactive gating

The standard way to gate points in a two-dimensional plot is to
- Interactively draw an arbitrary number of gates
- Click "Finish" button on the top-right corner of the plot

```{r, eval = FALSE}
tidygate_gate <-
tidygate_data %>%
gate(

# grouping by
c(`ct 1`, `ct 2`),

# Dimensions
Dim1, Dim2
)

tidygate_gate
```

We can save our gates in a separate variable for later use

```{r, eval = FALSE}
my_gates = tidygate_gate %>% attr("gate")

my_gates
```

```{r, echo = FALSE}
my_gates = tidygate::gate_list
```

## Programmatic gating

We can use previously drawn gates to programmately add the gate column

```{r}

tidygate_data %>%
gate(

# grouping by
c(`ct 1`, `ct 2`),

# Dimensions
Dim1, Dim2,

# Pre-defined gates
gate_list = my_gates
)

```


73 changes: 71 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ tidygate: add gate information to your tibble
================

<!---

[![Build Status](https://travis-ci.org/stemangiola/tidygate.svg?branch=master)](https://travis-ci.org/stemangiola/tidygate) [![Coverage Status](https://coveralls.io/repos/github/stemangiola/tidygate/badge.svg?branch=master)](https://coveralls.io/github/stemangiola/tidygate?branch=master)

-->

<!-- badges: start -->

[![Lifecycle:maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
<!-- badges: end -->

Please have a look also to -
[nanny](https://github.com/stemangiola/nanny) for tidy high-level data
analysis and manipulation -
[tidyHeatmap](https://github.com/stemangiola/tidyHeatmap) for producing
heatmaps following tidy principles -
[tidybulk](https://github.com/stemangiola/tidybulk) for tidy and modular
transcriptomics analyses

It interactively or programmately labels points within custom gates on
two dimensions, according to tidyverse principles. The information is
added to your tibble. It is based on the package `gatepoints` from Wajid
Expand Down Expand Up @@ -45,3 +51,66 @@ The main benefits are
``` r
devtools::install_github("stemangiola/tidygate")
```

## Interactive gating

The standard way to gate points in a two-dimensional plot is to -
Interactively draw an arbitrary number of gates - Click “Finish” button
on the top-right corner of the plot

``` r
tidygate_gate <-
tidygate_data %>%
gate(

# grouping by
c(`ct 1`, `ct 2`),

# Dimensions
Dim1, Dim2
)

tidygate_gate
```

We can save our gates in a separate variable for later use

``` r
my_gates = tidygate_gate %>% attr("gate")

my_gates
```

## Programmatic gating

We can use previously drawn gates to programmately add the gate column

``` r
tidygate_data %>%
gate(

# grouping by
c(`ct 1`, `ct 2`),

# Dimensions
Dim1, Dim2,

# Pre-defined gates
gate_list = my_gates
)
```

## # A tibble: 2,240 x 9
## group hierarchy `ct 1` `ct 2` relation cancer_ID Dim1 Dim2 gate
## <chr> <dbl> <chr> <chr> <dbl> <chr> <dbl> <dbl> <chr>
## 1 adrenal 1 endothel… epitheli… -1 ACC -0.874 -0.239 0
## 2 adrenal 1 endothel… fibrobla… -1 ACC -0.740 0.114 1
## 3 adrenal 1 endothel… immune_c… -1 ACC -0.988 0.118 0
## 4 adrenal 1 epitheli… endothel… 1 ACC 0.851 0.261 0
## 5 adrenal 1 epitheli… fibrobla… 1 ACC 0.839 0.320 0
## 6 adrenal 1 epitheli… immune_c… 1 ACC 0.746 0.337 0
## 7 adrenal 1 fibrobla… endothel… 1 ACC 0.722 -0.0696 0
## 8 adrenal 1 fibrobla… epitheli… -1 ACC -0.849 -0.317 0
## 9 adrenal 1 fibrobla… immune_c… 0.52 ACC -0.776 -0.383 0
## 10 adrenal 1 immune_c… endothel… 1 ACC 0.980 -0.116 0
## # … with 2,230 more rows
53 changes: 52 additions & 1 deletion vignettes/introdution.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ library(knitr)
knitr::opts_chunk$set(cache = TRUE, warning = FALSE,
message = FALSE, cache.lazy = FALSE)


library(dplyr)
library(tidygate)

```

Expand Down Expand Up @@ -58,6 +59,56 @@ element | dimension1 | dimension2 | annotations | Gate |
`chr` or `fctr` | `chr` or `fctr` | `numeric` | ... | ...


## Interactive gating

The standard way to gate points in a two-dimensional plot is to
- Interactively draw an arbitrary number of gates
- Click "Finish" button on the top-right corner of the plot

```{r, eval = FALSE}
tidygate_gate <-
tidygate_data %>%
gate(

# grouping by
c(`ct 1`, `ct 2`),

# Dimensions
Dim1, Dim2
)

tidygate_gate
```

We can save our gates in a separate variable for later use

```{r, eval = FALSE}
my_gates = tidygate_gate %>% attr("gate")

my_gates
```

```{r, echo = FALSE}
my_gates = tidygate::gate_list
```

## Programmatic gating

We can use previously drawn gates to programmately add the gate column

```{r}

tidygate_data %>%
gate(

# grouping by
c(`ct 1`, `ct 2`),

# Dimensions
Dim1, Dim2,

# Pre-defined gates
gate_list = my_gates
)

```