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

ODC-182 Support logical and factor CytoExploreR's clustering #260

Draft
wants to merge 1 commit into
base: devel
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions R/wrapper-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,35 @@


resType <- class(filterRes)
if(extends(resType, "filter")||extends(resType, "filters")||extends(resType, "logical")||extends(resType, "factor")){

# format filterRes to ensure gates per sample
# list can be supplied per sample to allow sample-wise logical|factor
if(class(filterRes) == "list" && all(
sapply(
filterRes,
function(v) {
any(
sapply(
c("filter", "filters", "logical", "factor"),
function(i) {
extends(class(v), i)
}
)
)
}
)
) && length(filterRes) == length(fs)) {
# names missing
if(is.null(names(filterRes))){
names(filterRes) <- sampleNames(fs)
}
# names don't match
if(!all(sampleNames(fs) %in% names(filterRes))) {
stop(
"Gates should be supplied per sample in a named list."
)
}
list(filterRes)
} else if(extends(resType, "filter")||extends(resType, "filters")||extends(resType, "logical")||extends(resType, "factor")){
#replicate the filter across samples
list(sapply(sampleNames(fs),function(i)filterRes, simplify = FALSE))
}else{
Expand Down