Skip to content

Commit

Permalink
Merge pull request #119 from krassowski/query-set-on-matrix-highlight…
Browse files Browse the repository at this point in the history
…-on-top

Allow to query by sets on intersections matrix, improve visuals
  • Loading branch information
krassowski authored May 1, 2021
2 parents cc90ddd + d0f407a commit 112a2e0
Show file tree
Hide file tree
Showing 16 changed files with 453 additions and 73 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ComplexUpset
Type: Package
Title: Create Complex UpSet Plots Using 'ggplot2' Components
Version: 1.2.1
Version: 1.2.1.9000
Authors@R: person(
"Michał", "Krassowski", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-9638-7785"))
Expand Down
16 changes: 13 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Version 1.3.0

unreleased

Changes:
- sets on intersection matrix can now be highlighted using `upset_query()` #115

Bug fixes:
- alleviate visual glitch of `geom_segment` in intersections matrix showing up with an outline #113

# Version 1.2.1

2021-04-25

Bug fixes:
- fixed metadata order in data frame returned by `arrange_venn()` function #116
- fixed metadata order in data frame returned by `arrange_venn()` function #116

# Version 1.2.0

Expand All @@ -20,8 +30,8 @@ Major improvements:
- stripes color and other attributes can now be mapped to data #111

Minor improvements:
- data.table can be passed instead of data.frame (the conversion will be performed atuomatically) #105
- warning will be shown if a vecotor is provided instead of a list to the `intersections` argument #109
- data.table can be passed instead of data.frame (the conversion will be performed automatically) #105
- warning will be shown if a vector is provided instead of a list to the `intersections` argument #109
- when `intersections` argument includes sets not specified in `intersect`, a warning will be issued and execution will proceed as if those were included in `intersect` #109
- when incorrect names of sets are passed to `intersections` argument, those will be highlighted and plotting will be aborted #109

Expand Down
26 changes: 16 additions & 10 deletions R/upset.R
Original file line number Diff line number Diff line change
Expand Up @@ -980,14 +980,20 @@ upset = function(

matrix_intersect_queries = intersect_queries(queries_for(queries, 'intersections_matrix'), data)
matrix_group_by_queries = group_by_queries(queries_for(queries, 'intersections_matrix'), data$sanitized_labels)
matrix_set_queries = set_queries(queries_for(queries, 'intersections_matrix'), data$sanitized_labels)

intersection_query_matrix = get_highlights_data(data$matrix_frame, 'intersection', matrix_intersect_queries)
group_query_matrix = get_highlights_data(data$matrix_frame, 'group_by_group', matrix_group_by_queries)
set_query_matrix = get_highlights_data(data$matrix_frame, 'group', matrix_set_queries)


query_matrix = merge_rows(
intersection_query_matrix,
group_query_matrix
)
merge_rows(
intersection_query_matrix,
group_query_matrix
),
set_query_matrix
)

query_matrix = query_matrix[query_matrix$value == TRUE, ]

Expand Down Expand Up @@ -1019,13 +1025,6 @@ upset = function(
size=dot_size,
na.rm=TRUE
)),
# the highlighted dot
highlight_layer(
intersections_matrix$geom,
geom_point,
query_matrix,
args=list(size=dot_size)
),
# interconnectors on the dots
list(intersections_matrix$segment * geom_segment(aes(
x=intersection,
Expand All @@ -1047,6 +1046,13 @@ upset = function(
),
na.rm=TRUE
)
),
# the highlighted dot
highlight_layer(
intersections_matrix$geom,
geom_point,
query_matrix,
args=list(size=dot_size)
)
)

Expand Down
16 changes: 8 additions & 8 deletions tests/figs/examples/example-0-2-region-selection-modes-3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions tests/figs/examples/example-4-3-logarithmic-scale-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 112a2e0

Please sign in to comment.