{"id":13788598,"url":"https://github.com/krassowski/complex-upset","last_synced_at":"2025-05-16T15:09:04.466Z","repository":{"id":41201126,"uuid":"236336935","full_name":"krassowski/complex-upset","owner":"krassowski","description":"A library for creating complex UpSet plots with ggplot2 geoms","archived":false,"fork":false,"pushed_at":"2024-03-09T15:04:43.000Z","size":45459,"stargazers_count":507,"open_issues_count":71,"forks_count":30,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-06T20:40:39.699Z","etag":null,"topics":["ggplot","ggplot2","patchwork","python","rstat","rstats","upset","upsetr","venn","venn-diagram","visualization"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krassowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-01-26T16:06:20.000Z","updated_at":"2025-04-29T08:36:24.000Z","dependencies_parsed_at":"2022-07-14T10:31:17.789Z","dependency_job_id":"d7b50138-5dee-4236-81ec-22be02c8eb76","html_url":"https://github.com/krassowski/complex-upset","commit_stats":{"total_commits":325,"total_committers":5,"mean_commits":65.0,"dds":"0.15692307692307694","last_synced_commit":"bb3f10a35eb2033754620aacdedc1d52357f13e4"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krassowski%2Fcomplex-upset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krassowski%2Fcomplex-upset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krassowski%2Fcomplex-upset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krassowski%2Fcomplex-upset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krassowski","download_url":"https://codeload.github.com/krassowski/complex-upset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ggplot","ggplot2","patchwork","python","rstat","rstats","upset","upsetr","venn","venn-diagram","visualization"],"created_at":"2024-08-03T21:00:50.824Z","updated_at":"2025-05-16T15:08:59.458Z","avatar_url":"https://github.com/krassowski.png","language":"Jupyter Notebook","readme":"# ComplexUpset\n\n[![test](https://github.com/krassowski/complex-upset/workflows/test/badge.svg)](https://github.com/krassowski/complex-upset/actions?query=workflow%3Atest)\n[![codecov](https://codecov.io/gh/krassowski/complex-upset/branch/master/graph/badge.svg)](https://app.codecov.io/gh/krassowski/complex-upset)\n[![CRAN_version](https://www.r-pkg.org/badges/version/ComplexUpset?color=blue)](https://CRAN.R-project.org/package=ComplexUpset)\n[![Conda version](https://img.shields.io/conda/vn/conda-forge/r-complexupset.svg)](https://anaconda.org/conda-forge/r-complexupset)\n[![DOI](https://zenodo.org/badge/236336935.svg)](https://zenodo.org/badge/latestdoi/236336935)\n\nQuick links: [Documentation](https://krassowski.github.io/complex-upset/) | [Installation](https://github.com/krassowski/complex-upset#Install) | [R examples](https://krassowski.github.io/complex-upset/articles/Examples_R.html) | [Python examples](https://krassowski.github.io/complex-upset/articles/Examples_Python.html)\n\n## Showcase\n\nGet all the goodies of `UpSetR`, but with full extensibility of `ggplot2`.\n\n![Example UpSet plot](https://raw.githubusercontent.com/krassowski/complex-upset/master/movies.png)\n\n\u003cdetails\u003e\n    \u003csummary\u003eClick here to display the source code\u003c/summary\u003e\n\n```R\nlibrary(ggplot2)\nlibrary(ComplexUpset)\n\nif(!require(ggplot2movies)) install.packages('ggplot2movies')\nmovies = ggplot2movies::movies\ngenres = c('Action', 'Animation', 'Comedy', 'Drama', 'Documentary', 'Romance')\n\nupset(\n    movies,\n    genres,\n    annotations = list(\n        'Length'=ggplot(mapping=aes(x=intersection, y=length)) + geom_boxplot(),\n        'Rating'=ggplot(mapping=aes(x=intersection, y=rating))\n            # if you do not want to install ggbeeswarm, you can use geom_jitter\n            + ggbeeswarm::geom_quasirandom(aes(color=log10(votes)))\n            + geom_violin(width=1.1, alpha=0.5)\n    ),\n    queries=list(\n        upset_query(\n            intersect=c('Drama', 'Comedy'),\n            color='red',\n            fill='red',\n            only_components=c('intersections_matrix', 'Intersection size')\n        ),\n        upset_query(\n            set='Drama',\n            fill='blue'\n        ),\n        upset_query(\n            intersect=c('Romance', 'Drama'),\n            fill='yellow',\n            only_components=c('Length')\n        )\n    ),\n    min_size=10,\n    width_ratio=0.1\n)\n```\n\n\u003c/details\u003e\n\n\nThe full list of examples is available in the [documentation](https://krassowski.github.io/complex-upset/articles/Examples_Python.html); it also contains instructions for the use from Python.\n\n## Install\n\nTo get the most recent version, open `R` and run:\n\n```R\nif(!require(devtools)) install.packages(\"devtools\")\ndevtools::install_github(\"krassowski/complex-upset\")\n```\n\nAlternatively, to get a stable CRAN release (which may be one version behind at times):\n\n```R\ninstall.packages('ComplexUpset')\n```\n\nOr, if you use conda/mamba:\n\n```R\nconda install -c conda-forge r-complexupset\n```\n\n## How it compares to other packages?\n\n- [UpSetR](https://github.com/hms-dbmi/UpSetR) is a powerful tool and the pioneer in the UpSet visualisations; it was not designed to be extended with ggplot components. Unfortunately, the repository is no longer active (for two years now).\n- [ggupset](https://github.com/const-ae/ggupset) uses scales to convert a single plot to upsets plots, e.g. with `scale_x_upset` - a really nice approach, recommended for simple ggplot.\n- a cowplot-based upset was demonstrated in an [online publication](https://rpubs.com/alexeilutay/upsetr), however cowplot (a great tool at the time) got superseded by even greater tool: [patchwork](https://github.com/thomasp85/patchwork), which is what is used by ComplexUpset.\n- [ComplexHeatmap](https://github.com/jokergoo/ComplexHeatmap) also offers a way to generate [UpSet plots with annotations](https://jokergoo.github.io/ComplexHeatmap-reference/book/upset-plot.html); while not ggplot2-centered, it provides extensive customization options, with a clear API. It may be the best choice if you already use it for heatmaps.\n\nUse whichever tool you find the most useful for your particular use. The rational of making this repository public is not only to share the code, but also to demonstrate how simple it is now to create complex visualisations with patchwork (without the need to learn the ggplot internals).\n\nFor the interactive use, check out the [VCG/upset](https://github.com/VCG/upset). Regardless of the tool chosen, you may want to cite [(Lex et al, 2014)](https://dx.doi.org/10.1109/TVCG.2014.2346248) when using UpSet plots, especially in fields still dominated by Venn diagrams.\n\n## Get inspired\n\nHere are example publications and preprints including figures generated with this library:\n\n- Martín-Martín et al. (2020). [Google Scholar, Microsoft Academic, Scopus, Dimensions, Web of Science, and OpenCitations’ COCI: a multidisciplinary comparison of coverage via citations](https://doi.org/10.1007/s11192-020-03690-4), *Scientometrics*: [Figure 2](https://link.springer.com/article/10.1007/s11192-020-03690-4#Fig2)\n- Krassowski et al. (2020). [Analyses for \"State of the field in multi-omics research: from computational needs to data mining and sharing](https://doi.org/10.3389/fgene.2020.610798), *Frontiers in Genetics*: [Figure 5](https://www.frontiersin.org/articles/10.3389/fgene.2020.610798/full#F5)\n- Green et al. (2020). [Metabolic correlates of late midlife cognitive function: findings from the 1946 British Birth Cohort](https://doi.org/10.1101/2020.11.23.20236463), *medRxiv*: [Figure 2](https://www.medrxiv.org/content/10.1101/2020.11.23.20236463v2.full#F2)\n- McDaniel et al. (2020). [Metabolic differentiation of co-occurring Accumulibacter clades revealed through genome-resolved metatranscriptomics](https://doi.org/10.1101/2020.11.23.394700), *bioRxiv* [Figure 3](https://www.biorxiv.org/content/10.1101/2020.11.23.394700v1.full#F3)\n- Kozlowski et al. (2020). [Transposable Elements are an evolutionary force shaping genomic plasticity in the parthenogenetic root-knot nematode Meloidogyne incognita](https://doi.org/10.1101/2020.04.30.069948), *bioRxiv*: [Figure 7](https://www.biorxiv.org/content/10.1101/2020.04.30.069948v4.full#F7)\n- Swamy et al. (2020). [A long read optimized de novo transcriptome pipeline reveals novel ocular developmentally regulated gene isoforms and disease targets](https://doi.org/10.1101/2020.08.21.261644), *bioRxiv*: [Figure 4](https://www.biorxiv.org/content/10.1101/2020.08.21.261644v2.full#F4)\n\nThe list is not meant to be exhaustive, but representative of applications to different fields, and of different usage ideas. You are welcome to add your own publication by [suggesting an edit](https://github.com/krassowski/complex-upset/edit/master/README.md).\n\n## Testing\n\nThe unit tests are run with `testhat`, and the visual \"doppelganger\" tests use `vdiffr`.\n\nThe test cases for visual tests are auto-generated from the examples in the documentation; after changing or adding an example, please run:\n\n- `scripts/prepare_for_tests.sh` to generate updated test cases, and\n- `scripts/manage_visual_tests.sh` to validate the generated images.\n\n## Acknowledgements\n\nOriginally developed in course of a DPhil programme in Women's \u0026 Reproductive Health at [OxfordNuffieldWRH](https://github.com/OxfordNuffieldWRH).\n","funding_links":[],"categories":["R","ggplot"],"sub_categories":["Additional Plot Types"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrassowski%2Fcomplex-upset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrassowski%2Fcomplex-upset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrassowski%2Fcomplex-upset/lists"}