Coder Social home page Coder Social logo

stemangiola / tidygate Goto Github PK

View Code? Open in Web Editor NEW
19.0 5.0 3.0 814 KB

Label elements within user drawn gates

R 100.00%
tidyverse tidy-data r gate tibble pipe dplyr drawing programmatic interactive facs clustering dataviz datavis ggplot2 single-cell single-cell-rna-seq seurat

tidygate's Issues

Loading/gating

File loaded into R:

> library(readxl)
> LiveDead <- read_excel("Documents/LiveDead.xlsx", 
+     col_types = c("numeric", "numeric", "text"))
> View(LiveDead)                                                                                    
> LiveDead
# A tibble: 5,046 x 3
   Mean488x_525m Mean560x_607m Cell_Status
           <dbl>         <dbl> <chr>      
 1         1381.          302. Live       
 2         7104           266. Live       
 3         8073.          251. Live       
 4          960.          594. Live       
 5          814.          426. Live       
 6         8985.          250. Live       
 7        23917.          292. Live       
 8          990.          548. Live       
 9         1317.          464. Live       
10         7952.          323. Live       
# … with 5,036 more rows

LiveDead.xlsx

Attempt to gate data

> LiveDead %>% gate(.data = LiveDead, .dim1 = Mean488x_525m, .dim2 = Mean560x_607m)
Error: Must subset columns with a valid subscript vector.
x Subscript has the wrong type `tbl_df<
  Mean488x_525m: double
  Mean560x_607m: double
  Cell_Status  : character
>`.
ℹ It must be numeric or character.

Gate not reflected as I did

gates used to work properly but suddenly all the gate I made were shown on the left top with smaller size. Is this a bug or am I doing something wrong? Below is my code and error message. Thx!

harmonized_gated1 <-
harmonized_seurat %>%
mutate(gated1 = tidygate::gate_chr(
UMAP_1, UMAP_2, .color = seurat_clusters,
.size = 0.1
))
Mark region on plot.
Error in dplyr::mutate():
ℹ In argument: gated1 = tidygate::gate_chr(...).
Caused by error in map():
ℹ In index: 1.
Caused by error in data[i, 1]:
! subscript out of bounds
Run rlang::last_trace() to see where the error occurred.

image

rasterization needed for big datasets

Hey everyone,
I have a dataset of 370k cells, and when I run tidygate it is very laggy,and out of 3 times, it works once without crashing. I think a restarization is needed once you have more than 100k cells, like the DimPlot in Seurat does it.
Once I reduce the number of plotted cells, the algorithm works smoother.
Cheers

Improve performances and interface of `tidygate` for large single-cell objects

tidygate allows gating points from a tibble, visually procedurally and in a replicable way, compatibly with a pipe-oriented programming style

https://github.com/stemangiola/tidygate

With an arbitrarily large amount of points (1M cells), it struggles, mostly at the visualisation step.

We propose a downsample strategy for the visual preview, while the selection would be done on all data points.

PLEASE IGNORE THIS AT THE MOMENT: As a possible second PR, the plotting backend might be changed from the old interactive plotting style base-R (often broken in the R studio server). A more modern Photoshop, the lasso-style selector, would be great. An example is CellSelector() from Seurat. However, we would need to implement lasso-style gating and multiple gating.

Not able to select points

Hi,
I would love to use your package but somehow I am not able to make it work. It would be great if you could help me understand, what is going wrong here. When I try the follwoing example I always get this error:

ggplot(tidygate_data)+geom_point(mapping = aes(x=Dim1,y=Dim2))

tidygate_gate <-

  • tidygate_data %>%
  • mutate( gate = gate_chr( Dim1, Dim2 ) )
    Error: Problem with mutate() column gate.
    gate = gate_chr(Dim1, Dim2).
    x Must extract column with a single valid subscript.
    x Subscript var has size 0 but must be size 1.
    Run rlang::last_error() to see where the error occurred.

Backtrace:

  1. tidygate_data %>% mutate(gate = gate_chr(Dim1, Dim2))
  2. dplyr:::pull.data.frame(., color_hexadecimal)
  3. tidyselect::vars_pull(names(.data), !!enquo(var))
  4. tidyselect:::pull_as_location2(loc, n, vars)
  5. vctrs::num_as_location2(i, n = n, negative = "ignore", arg = "var")
  6. vctrs:::result_get(...)

When I run the second part uncluding gate_chr, a new plot appears in the plot area (I am using RStudio), but it is empty.

Let me know if you need any other info!
Thanks for your help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.