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

Using ngl_add_colours: retain segment order when displaying in flywire #109

Open
mmc46 opened this issue Mar 19, 2021 · 0 comments
Open

Comments

@mmc46
Copy link
Contributor

mmc46 commented Mar 19, 2021

Is it possible to ensure the order of segments given to ngl_add_colours is maintained in the flywire display?

For example, when using a dataframe of flywire ids and colours for ngl_add_colours.

I think it might be a more general issue of how flywire orders the segments in the display, seems to be in a different order to the order of the segments in a scene.

library(fafbseg)
#> Loading required package: nat
#> Loading required package: rgl
#> Registered S3 method overwritten by 'nat':
#>   method             from
#>   as.mesh3d.ashape3d rgl
#> 
#> Attaching package: 'nat'
#> The following object is masked from 'package:rgl':
#> 
#>     wire3d
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, union
#> Run dr_fafbseg() for a status report on your installation

test_order <-
  structure(
    list(
      flywire.id = c(
        "720575940614744123",
        "720575940630152273",
        "720575940621821163",
        "720575940629889095",
        "720575940617400024"
      ),
      rev_type = structure(
        c(1L, 1L, 2L, 2L, 3L),
        .Label = c("DNa11",
                   "DNa12", "DNa13"),
        class = "factor"
      ),
      side = c("L", "R", "L",
               "R", "L"),
      col_to_plot = c("#FF0000", "#FF0000", "#FF6600", "#FF6600",
                      "#FFCC00")
    ),
    row.names = c(NA,-5L),
    class = c("tbl_df", "tbl",
              "data.frame")
  )

test_order$flywire.id
#> [1] "720575940614744123" "720575940630152273" "720575940621821163"
#> [4] "720575940629889095" "720575940617400024"

fw_url=with_segmentation('flywire', getOption('fafbseg.sampleurl'))
sc <- ngl_add_colours(fw_url, colours = test_order[,c("flywire.id", "col_to_plot")])
# browseURL(as.character(sc))

Screenshot 2021-03-19 at 17 29 05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant