From 7a0dd24984c0ad0e950a49f7930c313fdf3c0db4 Mon Sep 17 00:00:00 2001 From: stemangiola Date: Wed, 25 Nov 2020 10:42:06 +1100 Subject: [PATCH 1/3] improve readme --- README.Rmd | 58 +++++++++++++++++++++++++++++++++++++++++++ README.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 129 insertions(+), 2 deletions(-) diff --git a/README.Rmd b/README.Rmd index 108fcdc..62ccab1 100755 --- a/README.Rmd +++ b/README.Rmd @@ -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. @@ -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 + ) + +``` + + diff --git a/README.md b/README.md index eececc5..79d4856 100755 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ tidygate: add gate information to your tibble ================ @@ -12,6 +10,14 @@ tidygate: add gate information to your tibble [![Lifecycle:maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) +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 @@ -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 + ## + ## 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 From 288ec2b34868dbca21e9c688e1bdee1860bf93b2 Mon Sep 17 00:00:00 2001 From: stemangiola Date: Wed, 25 Nov 2020 10:57:34 +1100 Subject: [PATCH 2/3] update vignette --- vignettes/introdution.Rmd | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/vignettes/introdution.Rmd b/vignettes/introdution.Rmd index 1512c76..4181627 100755 --- a/vignettes/introdution.Rmd +++ b/vignettes/introdution.Rmd @@ -58,6 +58,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 + ) +``` \ No newline at end of file From e17cd1e4a46642fb684c19413069c0c3a0f815b2 Mon Sep 17 00:00:00 2001 From: stemangiola Date: Wed, 25 Nov 2020 11:05:03 +1100 Subject: [PATCH 3/3] fix vignette dependency --- vignettes/introdution.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vignettes/introdution.Rmd b/vignettes/introdution.Rmd index 4181627..d2f1f4f 100755 --- a/vignettes/introdution.Rmd +++ b/vignettes/introdution.Rmd @@ -26,7 +26,8 @@ library(knitr) knitr::opts_chunk$set(cache = TRUE, warning = FALSE, message = FALSE, cache.lazy = FALSE) - +library(dplyr) +library(tidygate) ```