{"id":14067172,"url":"https://github.com/stemangiola/tidygate","last_synced_at":"2026-02-20T16:01:37.584Z","repository":{"id":44654865,"uuid":"275099576","full_name":"stemangiola/tidygate","owner":"stemangiola","description":"Label elements within user drawn gates","archived":false,"fork":false,"pushed_at":"2025-10-10T05:12:03.000Z","size":6744,"stargazers_count":25,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-09T10:10:32.952Z","etag":null,"topics":["clustering","datavis","dataviz","dplyr","drawing","facs","gate","ggplot2","interactive","pipe","programmatic","r","seurat","single-cell","single-cell-rna-seq","tibble","tidy-data","tidyverse"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stemangiola.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-26T07:36:13.000Z","updated_at":"2025-10-10T05:12:07.000Z","dependencies_parsed_at":"2024-01-16T15:43:27.368Z","dependency_job_id":"3dd62ae5-6ef3-4dee-b552-a332948d37fb","html_url":"https://github.com/stemangiola/tidygate","commit_stats":{"total_commits":78,"total_committers":4,"mean_commits":19.5,"dds":0.0641025641025641,"last_synced_commit":"f05505d9ee22886f215140c0b67085722487d89b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/stemangiola/tidygate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stemangiola%2Ftidygate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stemangiola%2Ftidygate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stemangiola%2Ftidygate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stemangiola%2Ftidygate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stemangiola","download_url":"https://codeload.github.com/stemangiola/tidygate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stemangiola%2Ftidygate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29656589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clustering","datavis","dataviz","dplyr","drawing","facs","gate","ggplot2","interactive","pipe","programmatic","r","seurat","single-cell","single-cell-rna-seq","tibble","tidy-data","tidyverse"],"created_at":"2024-08-13T07:05:28.007Z","updated_at":"2026-02-20T16:01:37.568Z","avatar_url":"https://github.com/stemangiola.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\ntitle: \"tidygate: add gate information to your tibble\"\noutput: github_document\n---\n\n\u003c!---\n[![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)\n--\u003e\n\n\u003c!-- badges: start --\u003e\n  [![Lifecycle:maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n\u003c!-- badges: end --\u003e\n\n```{r setup, echo=FALSE, include=FALSE}\nlibrary(knitr)\nlibrary(tidygate)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(stringr)\nlibrary(readr)\n\nknitr::opts_chunk$set(cache = TRUE, warning = FALSE, message = FALSE, cache.lazy = FALSE)\n```\n\n## Introduction \n\ntidygate allows you to interactively gate points on a scatter plot. Interactively drawn gates are recorded and can be applied programmatically to reproduce results exactly. Programmatic gating is based on the package [gatepoints](https://github.com/wjawaid/gatepoints) by Wajid Jawaid. \n\nFor more tidy data analysis:\n\n- [tidyomics](https://github.com/tidyomics) - A software ecosystem for tidy analysis of omic data.\n- [tidyHeatmap](https://github.com/stemangiola/tidyHeatmap) - Produce heatmaps with tidy principles.\n\n## Installation\n\n```{r, eval=FALSE}\n# From Github\ndevtools::install_github(\"stemangiola/tidygate\")\n\n# From CRAN\ninstall.package(\"tidygate\")\n```\n\n## Example usage \n\ntidygate provides a single user-facing function: `gate`. The following examples make use of this function, four packages from the tidyverse and the inbuilt `mtcars` dataset. \n\n```{r}\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(stringr)\nlibrary(readr)\nlibrary(tidygate)\n\nmtcars |\u003e\n  head()\n```\n\nBy default, `gate` creates an interactive scatter plot based on user-defined X and Y coordinates. Colour, shape, size and alpha can be defined as constant values, or can be controlled by values in a specified column. \n\nOnce the plot has been created, multiple gates can be drawn with the mouse. When you have finished, click continue. `gate` will then return a vector of strings, recording the gates each X and Y coordinate pair is within.\n\n```{r eval=FALSE}\nmtcars_gated \u003c-\n  mtcars |\u003e\n  mutate(gated = gate(x = mpg, y = wt, colour = disp))\n```\n\n![](man/figures/demo_gate.gif)\n\n```{r, echo=FALSE}\nload(\"data/demo_gate_data.rda\")\n\n# Load pre-recorded brush path from data for example\ntidygate_env \u003c\u003c- rlang::env()\ntidygate_env$gates \u003c- demo_gate_data\n\nmtcars_gated \u003c- \n  mtcars |\u003e\n  mutate(gated = gate(x = mpg, y = wt, programmatic_gates = tidygate_env$gates))\n```\n\nTo select points which appear within any gates, filter for non-NA values. To select points which appear within a specific gate, string pattern matching can be used.\n\n```{r}\n# Select points within any gate\nmtcars_gated |\u003e \n  filter(!is.na(gated))\n\n# Select points within gate 2\nmtcars_gated |\u003e\n  filter(str_detect(gated, \"2\"))\n```\n\nDetails of the interactively drawn gates are saved to `tidygate_env$gates`. This variable is overwritten each time interactive gates are drawn, so save it right away if you would like to access it later.  \n\n```{r}\n# Inspect previously drawn gates\ntidygate_env$gates |\u003e\n  head()\n```\n\n```{r, eval=FALSE}\n# Save if needed\ntidygate_env$gates |\u003e\n  write_rds(\"important_gates.rds\")\n```\n\nIf previously drawn gates are supplied to the `programmatic_gates` argument, points will be gated programmatically. This feature allows the reproduction of previously drawn interactive gates.\n\n```{r, eval=FALSE}\nimportant_gates \u003c-\n  read_rds(\"important_gates.rds\")\n\nmtcars |\u003e\n  mutate(gated = gate(x = mpg, y = wt, programmatic_gates = important_gates)) |\u003e\n  filter(!is.na(gated))\n```\n\n```{r, echo=FALSE}\nmtcars |\u003e\n  mutate(gated = gate(x = mpg, y = wt, programmatic_gates = tidygate_env$gates)) |\u003e\n  filter(!is.na(gated))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstemangiola%2Ftidygate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstemangiola%2Ftidygate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstemangiola%2Ftidygate/lists"}