Skip to content

Commit

Permalink
Improve performance when specific intersections are requested
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Jul 1, 2022
1 parent 7134b90 commit f27c111
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,16 @@ upset_data = function(
unique(unlist(intersections_members)),
NOT_IN_KNOWN_SETS
)
provided_intersection_sizes = sapply(intersections_members, length)
provided_intersection_sizes[intersections_members == NOT_IN_KNOWN_SETS] = 0

# TODO: this is slow and memory hungry; ideally we would only get the relevant intersection straight away!
possible_intersections = all_intersections_matrix(intersect, NULL, 0, Inf)
possible_intersections = all_intersections_matrix(
intersect,
NULL,
min(provided_intersection_sizes),
max(provided_intersection_sizes)
)

relevant_intersections = rownames(possible_intersections[
rowSums(possible_intersections[, sets_from_manual_intersections]) > 0,
Expand Down Expand Up @@ -1057,4 +1064,4 @@ create_upset_abc_example = function() {
rep(F, 2)
)
)
}
}

0 comments on commit f27c111

Please sign in to comment.