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

Hotfix/fix gs get singlecell expression by gate #391

Merged
merged 4 commits into from
Aug 20, 2023

Conversation

mikejiang
Copy link
Member

@mikejiang mikejiang commented Aug 20, 2023

fix cpp11 string conversion bug reported by #390

before

> library(flowWorkspace)
> dataDir <- system.file("extdata",package="flowWorkspaceData")
> gs_dir <- list.files(dataDir, pattern = "gs_manual",full = TRUE)
> gs <- load_gs(gs_dir)
> mat <- gs_get_singlecell_expression_by_gate(gs, "CD3+")
.Error: Expected string vector of length 1

after

> mat <- gs_get_singlecell_expression_by_gate(gs, "CD3+")
.
> head(mat)
$CytoTrol_CytoTrol_1.fcs
         CD3 V450     SSC-A
    [1,] 2996.536  91113.96
    [2,] 2749.284  76954.91
    [3,] 2507.708  70116.48
    [4,] 2657.550  66052.55

@@ -467,16 +467,16 @@ test_that("add", {
gs_pop_remove("CD8_demo", gs = gs)
})

if(!isCpStaticGate)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-enable test

@@ -70,17 +70,14 @@ cpp11::writable::doubles_matrix<> cpp_getSingleCellExpressionByGate(cpp11::exter
cpp11::strings pops(markers_pops.at(i));
// merge the indices from multiple nodes for the same marker
for(int j = 0; j < pops.size(); ++j){
string pop = cpp11::as_cpp<std::string>(pops[j]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is offending line, where pops[j] doesn't appear to be cpp11:string anymore when pops is length of 1.
The fix is easy, remove explicit coercion, let cpp11 own magic auto coercion takes its place

@mikejiang mikejiang requested a review from gfinak August 20, 2023 03:55
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

Successfully merging this pull request may close these issues.

1 participant