Full Code of enblacar/SCpubr for AI

main a3ae2999ce50 cached
175 files
1.8 MB
420.9k tokens
1 requests
Download .txt
Showing preview only (1,926K chars total). Download the full file or copy to clipboard to get everything.
Repository: enblacar/SCpubr
Branch: main
Commit: a3ae2999ce50
Files: 175
Total size: 1.8 MB

Directory structure:
gitextract_myymkbek/

├── .Rbuildignore
├── .github/
│   ├── .gitignore
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug-report.md
│   │   └── feature-request.md
│   └── workflows/
│       ├── R-CMD-check.yaml
│       └── test-coverage.yaml
├── .gitignore
├── CRAN-SUBMISSION
├── DESCRIPTION
├── LICENSE.md
├── NAMESPACE
├── NEWS.md
├── R/
│   ├── data.R
│   ├── do_ActivityHeatmap.R
│   ├── do_AlluvialPlot.R
│   ├── do_BarPlot.R
│   ├── do_BeeSwarmPlot.R
│   ├── do_BoxPlot.R
│   ├── do_CNVHeatmap.R
│   ├── do_CellularStatesPlot.R
│   ├── do_ChordDiagramPlot.R
│   ├── do_ColorBlindCheck.R
│   ├── do_ColorPalette.R
│   ├── do_CorrelationHeatmap.R
│   ├── do_DimPlot.R
│   ├── do_DotPlot.R
│   ├── do_EnrichmentHeatmap.R
│   ├── do_ExpressionHeatmap.R
│   ├── do_FeaturePlot.R
│   ├── do_GroupwiseDEHeatmap.R
│   ├── do_LigandReceptorPlot.R
│   ├── do_LoadingsHeatmap.R
│   ├── do_MetadataHeatmap.R
│   ├── do_NebulosaPlot.R
│   ├── do_PathwayActivityHeatmap.R
│   ├── do_RankedEnrichmentHeatmap.R
│   ├── do_RankedExpressionHeatmap.R
│   ├── do_RidgePlot.R
│   ├── do_SCEnrichmentHeatmap.R
│   ├── do_SCExpressionHeatmap.R
│   ├── do_StripPlot.R
│   ├── do_TFActivityHeatmap.R
│   ├── do_TermEnrichmentPlot.R
│   ├── do_ViolinPlot.R
│   ├── do_VolcanoPlot.R
│   ├── do_WafflePlot.R
│   ├── globals.R
│   ├── plot_density_patch.R
│   ├── utils.R
│   └── zzz.R
├── README.md
├── cran-comments.md
├── data/
│   └── human_chr_locations.rda
├── inst/
│   ├── CITATION
│   └── extdata/
│       ├── de_genes_example.rds
│       ├── dorothea_activities_example.rds
│       ├── enriched_terms_example.rds
│       ├── genes_example.rds
│       ├── infercnv_object_example.rds
│       ├── infercnv_object_metacells_example.rds
│       ├── liana_output_example.rds
│       ├── metacell_mapping_example.rds
│       ├── progeny_activities_example.rds
│       └── seurat_dataset_example.rds
├── man/
│   ├── do_ActivityHeatmap.Rd
│   ├── do_AlluvialPlot.Rd
│   ├── do_BarPlot.Rd
│   ├── do_BeeSwarmPlot.Rd
│   ├── do_BoxPlot.Rd
│   ├── do_CNVHeatmap.Rd
│   ├── do_CellularStatesPlot.Rd
│   ├── do_ChordDiagramPlot.Rd
│   ├── do_ColorBlindCheck.Rd
│   ├── do_ColorPalette.Rd
│   ├── do_CorrelationHeatmap.Rd
│   ├── do_DimPlot.Rd
│   ├── do_DotPlot.Rd
│   ├── do_EnrichmentHeatmap.Rd
│   ├── do_ExpressionHeatmap.Rd
│   ├── do_FeaturePlot.Rd
│   ├── do_GroupwiseDEHeatmap.Rd
│   ├── do_LigandReceptorPlot.Rd
│   ├── do_LoadingsHeatmap.Rd
│   ├── do_MetadataHeatmap.Rd
│   ├── do_NebulosaPlot.Rd
│   ├── do_PackageReport.Rd
│   ├── do_PathwayActivityHeatmap.Rd
│   ├── do_RankedEnrichmentHeatmap.Rd
│   ├── do_RankedExpressionHeatmap.Rd
│   ├── do_RidgePlot.Rd
│   ├── do_SCEnrichmentHeatmap.Rd
│   ├── do_SCExpressionHeatmap.Rd
│   ├── do_StripPlot.Rd
│   ├── do_TFActivityHeatmap.Rd
│   ├── do_TermEnrichmentPlot.Rd
│   ├── do_ViolinPlot.Rd
│   ├── do_VolcanoPlot.Rd
│   ├── do_WafflePlot.Rd
│   ├── doc_function.Rd
│   ├── examples/
│   │   ├── examples_do_ActivityHeatmap.R
│   │   ├── examples_do_AlluvialPlot.R
│   │   ├── examples_do_BarPlot.R
│   │   ├── examples_do_BeeSwarmPlot.R
│   │   ├── examples_do_BoxPlot.R
│   │   ├── examples_do_CNVHeatmap.R
│   │   ├── examples_do_CellularStatesPlot.R
│   │   ├── examples_do_ChordDiagramPlot.R
│   │   ├── examples_do_ColorBlindCheck.R
│   │   ├── examples_do_ColorPalette.R
│   │   ├── examples_do_CorrelationHeatmap.R
│   │   ├── examples_do_DimPlot.R
│   │   ├── examples_do_DotPlot.R
│   │   ├── examples_do_EnrichmentHeatmap.R
│   │   ├── examples_do_ExpressionHeatmap.R
│   │   ├── examples_do_FeaturePlot.R
│   │   ├── examples_do_GroupwiseDEHeatmap.R
│   │   ├── examples_do_LigandReceptorPlot.R
│   │   ├── examples_do_LoadingsHeatmap.R
│   │   ├── examples_do_MetadataHeatmap.R
│   │   ├── examples_do_NebulosaPlot.R
│   │   ├── examples_do_PathwayActivityHeatmap.R
│   │   ├── examples_do_RankedEnrichmentHeatmap.R
│   │   ├── examples_do_RankedExpressionHeatmap.R
│   │   ├── examples_do_RidgePlot.R
│   │   ├── examples_do_SCEnrichmentHeatmap.R
│   │   ├── examples_do_SCExpressionHeatmap.R
│   │   ├── examples_do_StripPlot.R
│   │   ├── examples_do_TFActivityHeatmap.R
│   │   ├── examples_do_TermEnrichmentPlot.R
│   │   ├── examples_do_ViolinPlot.R
│   │   ├── examples_do_VolcanoPlot.R
│   │   └── examples_do_WafflePlot.R
│   ├── human_chr_locations.Rd
│   ├── named_list.Rd
│   └── named_vector.Rd
├── revdep/
│   ├── .gitignore
│   └── email.yml
├── tests/
│   ├── testthat/
│   │   ├── setup.R
│   │   ├── test-do_ActivityHeatmap.R
│   │   ├── test-do_AlluvialPlot.R
│   │   ├── test-do_BarPlot.R
│   │   ├── test-do_BeeSwarmPlot.R
│   │   ├── test-do_BoxPlot.R
│   │   ├── test-do_CNVHeatmap.R
│   │   ├── test-do_CellularStatesPlot.R
│   │   ├── test-do_ChordDiagramPlot.R
│   │   ├── test-do_ColorBlindCheck.R
│   │   ├── test-do_ColorPalette.R
│   │   ├── test-do_CorrelationHeatmap.R
│   │   ├── test-do_DimPlot.R
│   │   ├── test-do_DotPlot.R
│   │   ├── test-do_EnrichmentHeatmap.R
│   │   ├── test-do_ExpressionHeatmap.R
│   │   ├── test-do_FeaturePlot.R
│   │   ├── test-do_GroupwiseDEHeatmap.R
│   │   ├── test-do_LigandReceptorPlot.R
│   │   ├── test-do_LoadingsHeatmap.R
│   │   ├── test-do_MetadataHeatmap.R
│   │   ├── test-do_NebulosaPlot.R
│   │   ├── test-do_PathwayActivityHeatmap.R
│   │   ├── test-do_RankedEnrichmentHeatmap.R
│   │   ├── test-do_RankedExpressionHeatmap.R
│   │   ├── test-do_RidgePlot.R
│   │   ├── test-do_SCEnrichmentHeatmap.R
│   │   ├── test-do_SCExpressionHeatmap.R
│   │   ├── test-do_StripPlot.R
│   │   ├── test-do_TFActivityHeatmap.R
│   │   ├── test-do_TermEnrichmentPlot.R
│   │   ├── test-do_ViolinPlot.R
│   │   ├── test-do_VolcanoPlot.R
│   │   ├── test-do_WafflePlot.R
│   │   └── test-utils.R
│   └── testthat.R
└── vignettes/
    ├── .gitignore
    └── reference_manual.Rmd

================================================
FILE CONTENTS
================================================

================================================
FILE: .Rbuildignore
================================================
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^.mailmap$
^\.github$
^doc$
^Meta$
^codecov\.yml$
^.*\.Rproj$
^\.Rproj\.user$
^NEWS$
^cran-comments\.md$
^revdep$
^README\.Rmd$
^data-raw$
^pkgdown$
^_pkgdown\.yml$
^man/figures$
^man/figures/*
^tests/testthat/output_figure.svg$
^tests/testthat/test.jpeg$
^tests/testthat/test.pdf$
^tests/testthat/test.png$
^tests/testthat/test.svg$
^tests/testthat/test.tiff$
^CRAN-SUBMISSION$


================================================
FILE: .github/.gitignore
================================================
*.html


================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.md
================================================
---
name: "\U0001F41B | Bug report"
about: 'Found a bug?! '
title: BUG | FUNCTION NAME | BRIEF DESCRIPTION
labels: bug
assignees: enblacar

---

<!-- 
-----------------------------------------------------------------------------------
Hello! 

Thanks for opening an Issue in SCpubr!

Here are some guidelines to correctly generate an Issue for SCpubr:

Put all relevant information asked inside of the code placeholders, 
which are denoted by these quotes:

``` 
# Some important info goes here.
```

or 

```r
# Some R code goes here.
```

The only exception is the initial salutation, which should go as normal text.
This will make the Issue look neat, structured and easy to read :P 

Finally, provide a title following the suggested scheme:

Scheme: 
BUG | function name | Description

Example: 
BUG | do_FeaturePlot | Doing this causes this problem.

Thanks a lot!
Enrique
-----------------------------------------------------------------------------------
-->


<!-- Initial salutation -->


**Bug:**
```
# Your description of the bug goes here.
```


**Reproducible example:**
```r
# Your reproducible example goes here.
# How to make a good one: https://www.r-bloggers.com/2020/10/how-to-make-a-reprex/
```


**Error log:**
```r
# Paste the full error log here
```


**SCpubr version:**
```r
# Put the version of SCpubr that you are using here.
# Can be checked by: utils::packageVersion("SCpubr")
```


**Session info:**
```r
# Include the output of sessionInfo() here.
```


================================================
FILE: .github/ISSUE_TEMPLATE/feature-request.md
================================================
---
name: "\U0001F4AD | Feature request"
about: Do you have a cool idea you wish to be added to SCpubr?
title: REQUEST | FUNCTION NAME | DESCRIPTION
labels: enhancement
assignees: enblacar

---

<!-- 
-----------------------------------------------------------------------------------
Hello! 

Thanks for opening an Issue in SCpubr!

Here are some guidelines to correctly generate an Issue for SCpubr:

Put all relevant information asked inside of the code placeholders, 
which are denoted by these quotes:

``` 
# Some important info goes here.
```

or 

```r
# Some R code goes here.
```

The only exception is the initial salutation, which should go as normal text.
This will make the Issue look neat, structured and easy to read :P 

Finally, provide a title following the suggested scheme:

Scheme: 
REQUEST | function name | Description

Example: 
REQUEST | do_FeaturePlot | I want this to be added.

Thanks a lot!
Enrique
-----------------------------------------------------------------------------------
-->

<!-- Initial salutation -->


**Feature request:**
```
# Your description of the feature goes here.
```


**Example:**
```r
# Add an example image of how would you want the output to look like.
# Can be a screenshot from another source, a sketch concept, etc.
```


**Implementation:**
```r
# Do you have any ideas/leads on how to implement your suggestion?
# If not, just remove this part entirely.
```


**SCpubr version:**
```r
# Put the version of SCpubr that you are using here.
# Can be checked by: utils::packageVersion("SCpubr")
```


================================================
FILE: .github/workflows/R-CMD-check.yaml
================================================
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
  push:
    branches: [main, master]
  pull_request:

name: R-CMD-check.yaml

permissions: read-all

jobs:
  R-CMD-check:
    runs-on: ${{ matrix.config.os }}

    name: ${{ matrix.config.os }} (${{ matrix.config.r }})

    strategy:
      fail-fast: false
      matrix:
        config:
          - {os: macos-latest,   r: 'release'}
          - {os: windows-latest, r: 'release'}
          - {os: ubuntu-latest,   r: 'devel', http-user-agent: 'release'}
          - {os: ubuntu-latest,   r: 'release'}
          - {os: ubuntu-latest,   r: 'oldrel-1'}

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes

    steps:
      - uses: actions/checkout@v4

      - uses: r-lib/actions/setup-pandoc@v2

      - uses: r-lib/actions/setup-r@v2
        with:
          r-version: ${{ matrix.config.r }}
          http-user-agent: ${{ matrix.config.http-user-agent }}
          use-public-rspm: true

      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::rcmdcheck
          needs: check

      - uses: r-lib/actions/check-r-package@v2
        with:
          upload-snapshots: true
          build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'


================================================
FILE: .github/workflows/test-coverage.yaml
================================================
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
  push:
    branches: [main, master]
  pull_request:

name: test-coverage.yaml

permissions: read-all

jobs:
  test-coverage:
    runs-on: ubuntu-latest
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v4

      - uses: r-lib/actions/setup-r@v2
        with:
          use-public-rspm: true

      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::covr, any::xml2
          needs: coverage

      - name: Test coverage
        run: |
          cov <- covr::package_coverage(
            quiet = FALSE,
            clean = FALSE,
            install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
          )
          print(cov)
          covr::to_cobertura(cov)
        shell: Rscript {0}

      - uses: codecov/codecov-action@v5
        with:
          # Fail if error if not on PR, or if on PR and token is given
          fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
          files: ./cobertura.xml
          plugins: noop
          disable_search: true
          token: ${{ secrets.CODECOV_TOKEN }}

      - name: Show testthat output
        if: always()
        run: |
          ## --------------------------------------------------------------------
          find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
        shell: bash

      - name: Upload test results
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: coverage-test-failures
          path: ${{ runner.temp }}/package

================================================
FILE: .gitignore
================================================
.Rproj.user
.Rhistory
.RData
.Ruserdata
inst/doc
SCpubr.Rproj
/doc/
/Meta/
.renviron
.rprofile
.rproj
.rproj.user
.rhistory
.rapp.history
.o
.sl
.so
.dylib
.a
.dll
.def
.ds_store
unsrturl.bst
.log
.aux
.backups
.cproject
.directory
.dropbox
.exrc
.gdb.history
.gitattributes
.gitmodules
.hgtags
.project
.seed
.settings
.tm_properties
omnipathr-log/*
tests/testthat/omnipathr-log
tests/testthat/omnipathr-log/*
tests/testthat/_snaps/
tests/testthat/output_figure*
tests/testthat/test.*
output_figure*
test.*


================================================
FILE: CRAN-SUBMISSION
================================================
Version: 3.0.1
Date: 2026-01-09 14:31:18 UTC
SHA: 06d205ffb706dae9d0889dbd0bd0503f944a28d4


================================================
FILE: DESCRIPTION
================================================
Type: Package
Package: SCpubr
Title: Generate Publication Ready Visualizations of Single Cell
    Transcriptomics Data
Version: 3.0.1
Authors@R: 
    person("Enrique", "Blanco-Carmona", , "scpubr@gmail.com", role = c("cre", "aut"),
           comment = c(ORCID = "0000-0002-1208-1691"))
Description: A system that provides a streamlined way of generating
    publication ready plots for known Single-Cell transcriptomics data in
    a “publication ready” format. This is, the goal is to automatically
    generate plots with the highest quality possible, that can be used
    right away or with minimal modifications for a research article.
License: GPL-3
URL: https://github.com/enblacar/SCpubr/,
    https://enblacar.github.io/SCpubr-book/
BugReports: https://github.com/enblacar/SCpubr/issues/
Depends: 
    R (>= 4.0.0)
Suggests:
    assertthat,
    circlize,
    cli,
    cluster,
    colorspace,
    ComplexHeatmap,
    covr,
    decoupleR,
    dplyr (>= 1.1.0),
    enrichplot,
    forcats,
    ggalluvial (>= 0.12.5),
    ggbeeswarm,
    ggdist,
    ggExtra,
    ggh4x,
    ggplot2 (>= 3.4.0),
    ggplotify,
    ggrastr,
    ggrepel,
    ggridges,
    ggsignif,
    graphics,
    infercnv,
    KernSmooth,
    knitr,
    labeling,
    magrittr,
    MASS,
    Matrix,
    methods,
    Nebulosa,
    org.Hs.eg.db,
    patchwork,
    pheatmap,
    plyr,
    purrr,
    qpdf,
    RColorBrewer,
    rjags,
    rlang,
    rmarkdown,
    scales,
    scattermore,
    Seurat,
    SeuratObject,
    sf,
    stringr,
    svglite,
    testthat (>= 3.0.0),
    tibble,
    tidyr,
    UCell,
    viridis,
    withr
VignetteBuilder: 
    knitr
biocViews: Software, SingleCell, Visualization
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
LazyDataCompression: xz
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3


================================================
FILE: LICENSE.md
================================================
GNU General Public License
==========================

_Version 3, 29 June 2007_  
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_

Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.

## Preamble

The GNU General Public License is a free, copyleft license for software and other
kinds of works.

The licenses for most software and other practical works are designed to take away
your freedom to share and change the works. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change all versions of a
program--to make sure it remains free software for all its users. We, the Free
Software Foundation, use the GNU General Public License for most of our software; it
applies also to any other work released this way by its authors. You can apply it to
your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General
Public Licenses are designed to make sure that you have the freedom to distribute
copies of free software (and charge for them if you wish), that you receive source
code or can get it if you want it, that you can change the software or use pieces of
it in new free programs, and that you know you can do these things.

To protect your rights, we need to prevent others from denying you these rights or
asking you to surrender the rights. Therefore, you have certain responsibilities if
you distribute copies of the software, or if you modify it: responsibilities to
respect the freedom of others.

For example, if you distribute copies of such a program, whether gratis or for a fee,
you must pass on to the recipients the same freedoms that you received. You must make
sure that they, too, receive or can get the source code. And you must show them these
terms so they know their rights.

Developers that use the GNU GPL protect your rights with two steps: **(1)** assert
copyright on the software, and **(2)** offer you this License giving you legal permission
to copy, distribute and/or modify it.

For the developers' and authors' protection, the GPL clearly explains that there is
no warranty for this free software. For both users' and authors' sake, the GPL
requires that modified versions be marked as changed, so that their problems will not
be attributed erroneously to authors of previous versions.

Some devices are designed to deny users access to install or run modified versions of
the software inside them, although the manufacturer can do so. This is fundamentally
incompatible with the aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we have designed
this version of the GPL to prohibit the practice for those products. If such problems
arise substantially in other domains, we stand ready to extend this provision to
those domains in future versions of the GPL, as needed to protect the freedom of
users.

Finally, every program is threatened constantly by software patents. States should
not allow patents to restrict development and use of software on general-purpose
computers, but in those that do, we wish to avoid the special danger that patents
applied to a free program could make it effectively proprietary. To prevent this, the
GPL assures that patents cannot be used to render the program non-free.

The precise terms and conditions for copying, distribution and modification follow.

## TERMS AND CONDITIONS

### 0. Definitions

“This License” refers to version 3 of the GNU General Public License.

“Copyright” also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.

To “modify” a work means to copy from or adapt all or part of the work in
a fashion requiring copyright permission, other than the making of an exact copy. The
resulting work is called a “modified version” of the earlier work or a
work “based on” the earlier work.

A “covered work” means either the unmodified Program or a work based on
the Program.

To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for infringement under
applicable copyright law, except executing it on a computer or modifying a private
copy. Propagation includes copying, distribution (with or without modification),
making available to the public, and in some countries other activities as well.

To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through a computer
network, with no transfer of a copy, is not conveying.

An interactive user interface displays “Appropriate Legal Notices” to the
extent that it includes a convenient and prominently visible feature that **(1)**
displays an appropriate copyright notice, and **(2)** tells the user that there is no
warranty for the work (except to the extent that warranties are provided), that
licensees may convey the work under this License, and how to view a copy of this
License. If the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

### 1. Source Code

The “source code” for a work means the preferred form of the work for
making modifications to it. “Object code” means any non-source form of a
work.

A “Standard Interface” means an interface that either is an official
standard defined by a recognized standards body, or, in the case of interfaces
specified for a particular programming language, one that is widely used among
developers working in that language.

The “System Libraries” of an executable work include anything, other than
the work as a whole, that **(a)** is included in the normal form of packaging a Major
Component, but which is not part of that Major Component, and **(b)** serves only to
enable use of the work with that Major Component, or to implement a Standard
Interface for which an implementation is available to the public in source code form.
A “Major Component”, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system (if any) on which
the executable work runs, or a compiler used to produce the work, or an object code
interpreter used to run it.

The “Corresponding Source” for a work in object code form means all the
source code needed to generate, install, and (for an executable work) run the object
code and to modify the work, including scripts to control those activities. However,
it does not include the work's System Libraries, or general-purpose tools or
generally available free programs which are used unmodified in performing those
activities but which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for the work, and
the source code for shared libraries and dynamically linked subprograms that the work
is specifically designed to require, such as by intimate data communication or
control flow between those subprograms and other parts of the work.

The Corresponding Source need not include anything that users can regenerate
automatically from other parts of the Corresponding Source.

The Corresponding Source for a work in source code form is that same work.

### 2. Basic Permissions

All rights granted under this License are granted for the term of copyright on the
Program, and are irrevocable provided the stated conditions are met. This License
explicitly affirms your unlimited permission to run the unmodified Program. The
output from running a covered work is covered by this License only if the output,
given its content, constitutes a covered work. This License acknowledges your rights
of fair use or other equivalent, as provided by copyright law.

You may make, run and propagate covered works that you do not convey, without
conditions so long as your license otherwise remains in force. You may convey covered
works to others for the sole purpose of having them make modifications exclusively
for you, or provide you with facilities for running those works, provided that you
comply with the terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for you must do so
exclusively on your behalf, under your direction and control, on terms that prohibit
them from making any copies of your copyrighted material outside their relationship
with you.

Conveying under any other circumstances is permitted solely under the conditions
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.

### 3. Protecting Users' Legal Rights From Anti-Circumvention Law

No covered work shall be deemed part of an effective technological measure under any
applicable law fulfilling obligations under article 11 of the WIPO copyright treaty
adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention
of such measures.

When you convey a covered work, you waive any legal power to forbid circumvention of
technological measures to the extent such circumvention is effected by exercising
rights under this License with respect to the covered work, and you disclaim any
intention to limit operation or modification of the work as a means of enforcing,
against the work's users, your or third parties' legal rights to forbid circumvention
of technological measures.

### 4. Conveying Verbatim Copies

You may convey verbatim copies of the Program's source code as you receive it, in any
medium, provided that you conspicuously and appropriately publish on each copy an
appropriate copyright notice; keep intact all notices stating that this License and
any non-permissive terms added in accord with section 7 apply to the code; keep
intact all notices of the absence of any warranty; and give all recipients a copy of
this License along with the Program.

You may charge any price or no price for each copy that you convey, and you may offer
support or warranty protection for a fee.

### 5. Conveying Modified Source Versions

You may convey a work based on the Program, or the modifications to produce it from
the Program, in the form of source code under the terms of section 4, provided that
you also meet all of these conditions:

* **a)** The work must carry prominent notices stating that you modified it, and giving a
relevant date.
* **b)** The work must carry prominent notices stating that it is released under this
License and any conditions added under section 7. This requirement modifies the
requirement in section 4 to “keep intact all notices”.
* **c)** You must license the entire work, as a whole, under this License to anyone who
comes into possession of a copy. This License will therefore apply, along with any
applicable section 7 additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no permission to license the
work in any other way, but it does not invalidate such permission if you have
separately received it.
* **d)** If the work has interactive user interfaces, each must display Appropriate Legal
Notices; however, if the Program has interactive interfaces that do not display
Appropriate Legal Notices, your work need not make them do so.

A compilation of a covered work with other separate and independent works, which are
not by their nature extensions of the covered work, and which are not combined with
it such as to form a larger program, in or on a volume of a storage or distribution
medium, is called an “aggregate” if the compilation and its resulting
copyright are not used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work in an aggregate
does not cause this License to apply to the other parts of the aggregate.

### 6. Conveying Non-Source Forms

You may convey a covered work in object code form under the terms of sections 4 and
5, provided that you also convey the machine-readable Corresponding Source under the
terms of this License, in one of these ways:

* **a)** Convey the object code in, or embodied in, a physical product (including a
physical distribution medium), accompanied by the Corresponding Source fixed on a
durable physical medium customarily used for software interchange.
* **b)** Convey the object code in, or embodied in, a physical product (including a
physical distribution medium), accompanied by a written offer, valid for at least
three years and valid for as long as you offer spare parts or customer support for
that product model, to give anyone who possesses the object code either **(1)** a copy of
the Corresponding Source for all the software in the product that is covered by this
License, on a durable physical medium customarily used for software interchange, for
a price no more than your reasonable cost of physically performing this conveying of
source, or **(2)** access to copy the Corresponding Source from a network server at no
charge.
* **c)** Convey individual copies of the object code with a copy of the written offer to
provide the Corresponding Source. This alternative is allowed only occasionally and
noncommercially, and only if you received the object code with such an offer, in
accord with subsection 6b.
* **d)** Convey the object code by offering access from a designated place (gratis or for
a charge), and offer equivalent access to the Corresponding Source in the same way
through the same place at no further charge. You need not require recipients to copy
the Corresponding Source along with the object code. If the place to copy the object
code is a network server, the Corresponding Source may be on a different server
(operated by you or a third party) that supports equivalent copying facilities,
provided you maintain clear directions next to the object code saying where to find
the Corresponding Source. Regardless of what server hosts the Corresponding Source,
you remain obligated to ensure that it is available for as long as needed to satisfy
these requirements.
* **e)** Convey the object code using peer-to-peer transmission, provided you inform
other peers where the object code and Corresponding Source of the work are being
offered to the general public at no charge under subsection 6d.

A separable portion of the object code, whose source code is excluded from the
Corresponding Source as a System Library, need not be included in conveying the
object code work.

A “User Product” is either **(1)** a “consumer product”, which
means any tangible personal property which is normally used for personal, family, or
household purposes, or **(2)** anything designed or sold for incorporation into a
dwelling. In determining whether a product is a consumer product, doubtful cases
shall be resolved in favor of coverage. For a particular product received by a
particular user, “normally used” refers to a typical or common use of
that class of product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected to use, the
product. A product is a consumer product regardless of whether the product has
substantial commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to install and execute
modified versions of a covered work in that User Product from a modified version of
its Corresponding Source. The information must suffice to ensure that the continued
functioning of the modified object code is in no case prevented or interfered with
solely because modification has been made.

If you convey an object code work under this section in, or with, or specifically for
use in, a User Product, and the conveying occurs as part of a transaction in which
the right of possession and use of the User Product is transferred to the recipient
in perpetuity or for a fixed term (regardless of how the transaction is
characterized), the Corresponding Source conveyed under this section must be
accompanied by the Installation Information. But this requirement does not apply if
neither you nor any third party retains the ability to install modified object code
on the User Product (for example, the work has been installed in ROM).

The requirement to provide Installation Information does not include a requirement to
continue to provide support service, warranty, or updates for a work that has been
modified or installed by the recipient, or for the User Product in which it has been
modified or installed. Access to a network may be denied when the modification itself
materially and adversely affects the operation of the network or violates the rules
and protocols for communication across the network.

Corresponding Source conveyed, and Installation Information provided, in accord with
this section must be in a format that is publicly documented (and with an
implementation available to the public in source code form), and must require no
special password or key for unpacking, reading or copying.

### 7. Additional Terms

“Additional permissions” are terms that supplement the terms of this
License by making exceptions from one or more of its conditions. Additional
permissions that are applicable to the entire Program shall be treated as though they
were included in this License, to the extent that they are valid under applicable
law. If additional permissions apply only to part of the Program, that part may be
used separately under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

When you convey a copy of a covered work, you may at your option remove any
additional permissions from that copy, or from any part of it. (Additional
permissions may be written to require their own removal in certain cases when you
modify the work.) You may place additional permissions on material, added by you to a
covered work, for which you have or can give appropriate copyright permission.

Notwithstanding any other provision of this License, for material you add to a
covered work, you may (if authorized by the copyright holders of that material)
supplement the terms of this License with terms:

* **a)** Disclaiming warranty or limiting liability differently from the terms of
sections 15 and 16 of this License; or
* **b)** Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices displayed by works
containing it; or
* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that
modified versions of such material be marked in reasonable ways as different from the
original version; or
* **d)** Limiting the use for publicity purposes of names of licensors or authors of the
material; or
* **e)** Declining to grant rights under trademark law for use of some trade names,
trademarks, or service marks; or
* **f)** Requiring indemnification of licensors and authors of that material by anyone
who conveys the material (or modified versions of it) with contractual assumptions of
liability to the recipient, for any liability that these contractual assumptions
directly impose on those licensors and authors.

All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you received
it, or any part of it, contains a notice stating that it is governed by this License
along with a term that is a further restriction, you may remove that term. If a
license document contains a further restriction but permits relicensing or conveying
under this License, you may add to a covered work material governed by the terms of
that license document, provided that the further restriction does not survive such
relicensing or conveying.

If you add terms to a covered work in accord with this section, you must place, in
the relevant source files, a statement of the additional terms that apply to those
files, or a notice indicating where to find the applicable terms.

Additional terms, permissive or non-permissive, may be stated in the form of a
separately written license, or stated as exceptions; the above requirements apply
either way.

### 8. Termination

You may not propagate or modify a covered work except as expressly provided under
this License. Any attempt otherwise to propagate or modify it is void, and will
automatically terminate your rights under this License (including any patent licenses
granted under the third paragraph of section 11).

However, if you cease all violation of this License, then your license from a
particular copyright holder is reinstated **(a)** provisionally, unless and until the
copyright holder explicitly and finally terminates your license, and **(b)** permanently,
if the copyright holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

Moreover, your license from a particular copyright holder is reinstated permanently
if the copyright holder notifies you of the violation by some reasonable means, this
is the first time you have received notice of violation of this License (for any
work) from that copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

Termination of your rights under this section does not terminate the licenses of
parties who have received copies or rights from you under this License. If your
rights have been terminated and not permanently reinstated, you do not qualify to
receive new licenses for the same material under section 10.

### 9. Acceptance Not Required for Having Copies

You are not required to accept this License in order to receive or run a copy of the
Program. Ancillary propagation of a covered work occurring solely as a consequence of
using peer-to-peer transmission to receive a copy likewise does not require
acceptance. However, nothing other than this License grants you permission to
propagate or modify any covered work. These actions infringe copyright if you do not
accept this License. Therefore, by modifying or propagating a covered work, you
indicate your acceptance of this License to do so.

### 10. Automatic Licensing of Downstream Recipients

Each time you convey a covered work, the recipient automatically receives a license
from the original licensors, to run, modify and propagate that work, subject to this
License. You are not responsible for enforcing compliance by third parties with this
License.

An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an organization, or
merging organizations. If propagation of a covered work results from an entity
transaction, each party to that transaction who receives a copy of the work also
receives whatever licenses to the work the party's predecessor in interest had or
could give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if the predecessor
has it or can get it with reasonable efforts.

You may not impose any further restrictions on the exercise of the rights granted or
affirmed under this License. For example, you may not impose a license fee, royalty,
or other charge for exercise of rights granted under this License, and you may not
initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging
that any patent claim is infringed by making, using, selling, offering for sale, or
importing the Program or any portion of it.

### 11. Patents

A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The work thus
licensed is called the contributor's “contributor version”.

A contributor's “essential patent claims” are all patent claims owned or
controlled by the contributor, whether already acquired or hereafter acquired, that
would be infringed by some manner, permitted by this License, of making, using, or
selling its contributor version, but do not include claims that would be infringed
only as a consequence of further modification of the contributor version. For
purposes of this definition, “control” includes the right to grant patent
sublicenses in a manner consistent with the requirements of this License.

Each contributor grants you a non-exclusive, worldwide, royalty-free patent license
under the contributor's essential patent claims, to make, use, sell, offer for sale,
import and otherwise run, modify and propagate the contents of its contributor
version.

In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent (such as an
express permission to practice a patent or covenant not to sue for patent
infringement). To “grant” such a patent license to a party means to make
such an agreement or commitment not to enforce a patent against the party.

If you convey a covered work, knowingly relying on a patent license, and the
Corresponding Source of the work is not available for anyone to copy, free of charge
and under the terms of this License, through a publicly available network server or
other readily accessible means, then you must either **(1)** cause the Corresponding
Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the
patent license for this particular work, or **(3)** arrange, in a manner consistent with
the requirements of this License, to extend the patent license to downstream
recipients. “Knowingly relying” means you have actual knowledge that, but
for the patent license, your conveying the covered work in a country, or your
recipient's use of the covered work in a country, would infringe one or more
identifiable patents in that country that you have reason to believe are valid.

If, pursuant to or in connection with a single transaction or arrangement, you
convey, or propagate by procuring conveyance of, a covered work, and grant a patent
license to some of the parties receiving the covered work authorizing them to use,
propagate, modify or convey a specific copy of the covered work, then the patent
license you grant is automatically extended to all recipients of the covered work and
works based on it.

A patent license is “discriminatory” if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on the
non-exercise of one or more of the rights that are specifically granted under this
License. You may not convey a covered work if you are a party to an arrangement with
a third party that is in the business of distributing software, under which you make
payment to the third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties who would receive
the covered work from you, a discriminatory patent license **(a)** in connection with
copies of the covered work conveyed by you (or copies made from those copies), or **(b)**
primarily for and in connection with specific products or compilations that contain
the covered work, unless you entered into that arrangement, or that patent license
was granted, prior to 28 March 2007.

Nothing in this License shall be construed as excluding or limiting any implied
license or other defenses to infringement that may otherwise be available to you
under applicable patent law.

### 12. No Surrender of Others' Freedom

If conditions are imposed on you (whether by court order, agreement or otherwise)
that contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot convey a covered work so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not convey it at all. For example, if you
agree to terms that obligate you to collect a royalty for further conveying from
those to whom you convey the Program, the only way you could satisfy both those terms
and this License would be to refrain entirely from conveying the Program.

### 13. Use with the GNU Affero General Public License

Notwithstanding any other provision of this License, you have permission to link or
combine any covered work with a work licensed under version 3 of the GNU Affero
General Public License into a single combined work, and to convey the resulting work.
The terms of this License will continue to apply to the part which is the covered
work, but the special requirements of the GNU Affero General Public License, section
13, concerning interaction through a network will apply to the combination as such.

### 14. Revised Versions of this License

The Free Software Foundation may publish revised and/or new versions of the GNU
General Public License from time to time. Such new versions will be similar in spirit
to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies that
a certain numbered version of the GNU General Public License “or any later
version” applies to it, you have the option of following the terms and
conditions either of that numbered version or of any later version published by the
Free Software Foundation. If the Program does not specify a version number of the GNU
General Public License, you may choose any version ever published by the Free
Software Foundation.

If the Program specifies that a proxy can decide which future versions of the GNU
General Public License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the Program.

Later license versions may give you additional or different permissions. However, no
additional obligations are imposed on any author or copyright holder as a result of
your choosing to follow a later version.

### 15. Disclaimer of Warranty

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

### 16. Limitation of Liability

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE
OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

### 17. Interpretation of Sections 15 and 16

If the disclaimer of warranty and limitation of liability provided above cannot be
given local legal effect according to their terms, reviewing courts shall apply local
law that most closely approximates an absolute waiver of all civil liability in
connection with the Program, unless a warranty or assumption of liability accompanies
a copy of the Program in return for a fee.

_END OF TERMS AND CONDITIONS_

## How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to
the public, the best way to achieve this is to make it free software which everyone
can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them
to the start of each source file to most effectively state the exclusion of warranty;
and each file should have at least the “copyright” line and a pointer to
where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short notice like this
when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type 'show c' for details.

The hypothetical commands `show w` and `show c` should show the appropriate parts of
the General Public License. Of course, your program's commands might be different;
for a GUI interface, you would use an “about box”.

You should also get your employer (if you work as a programmer) or school, if any, to
sign a “copyright disclaimer” for the program, if necessary. For more
information on this, and how to apply and follow the GNU GPL, see
&lt;<http://www.gnu.org/licenses/>&gt;.

The GNU General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may consider it
more useful to permit linking proprietary applications with the library. If this is
what you want to do, use the GNU Lesser General Public License instead of this
License. But first, please read
&lt;<http://www.gnu.org/philosophy/why-not-lgpl.html>&gt;.


================================================
FILE: NAMESPACE
================================================
# Generated by roxygen2: do not edit by hand

export(do_ActivityHeatmap)
export(do_AlluvialPlot)
export(do_BarPlot)
export(do_BeeSwarmPlot)
export(do_BoxPlot)
export(do_CNVHeatmap)
export(do_CellularStatesPlot)
export(do_ChordDiagramPlot)
export(do_ColorBlindCheck)
export(do_ColorPalette)
export(do_CorrelationHeatmap)
export(do_DimPlot)
export(do_DotPlot)
export(do_EnrichmentHeatmap)
export(do_ExpressionHeatmap)
export(do_FeaturePlot)
export(do_GroupwiseDEHeatmap)
export(do_LigandReceptorPlot)
export(do_LoadingsHeatmap)
export(do_MetadataHeatmap)
export(do_NebulosaPlot)
export(do_PackageReport)
export(do_PathwayActivityHeatmap)
export(do_RankedEnrichmentHeatmap)
export(do_RankedExpressionHeatmap)
export(do_RidgePlot)
export(do_SCEnrichmentHeatmap)
export(do_SCExpressionHeatmap)
export(do_StripPlot)
export(do_TFActivityHeatmap)
export(do_TermEnrichmentPlot)
export(do_ViolinPlot)
export(do_VolcanoPlot)
export(do_WafflePlot)


================================================
FILE: NEWS.md
================================================
# SCpubr v3.0.2 (In Development)

## Bug fixes
-   Fixed bug in `do_DotPlot()` where passing metadata columns (e.g., UCell enrichment scores, `nCount_RNA`, `nFeature_RNA`) as features would cause a "subscript out of bounds" error. The function now correctly retrieves metadata features from `sample@meta.data` alongside gene features from the assay matrix, allowing both to be plotted together.

## Documentation
-   Improved roxygen titles and descriptions for `do_ViolinPlot()`, `do_DimPlot()`, `do_FeaturePlot()`, `do_NebulosaPlot()`, `do_DotPlot()`, `do_BeeSwarmPlot()`, `do_CellularStatesPlot()`, and `do_WafflePlot()`. Replaced uninformative "Wrapper for ..." titles with descriptive summaries of each function's purpose.

# SCpubr v3.0.1

## General
-   Fixed compatibility with SeuratObject >= 5.0.0. Updated all instances of `GetAssayData()` to use the `layer` parameter instead of the deprecated `slot` parameter when SeuratObject version is 5.0.0 or higher. Affected functions: `do_FeaturePlot()`, `do_SCExpressionHeatmap()`, `do_CorrelationHeatmap()`, `do_LoadingsHeatmap()`, `do_TFActivityHeatmap()`, `do_PathwayActivityHeatmap()`, and `do_StripPlot()`.
-   Added compatibility wrapper for `do_NebulosaPlot()` to handle Nebulosa package incompatibility with SeuratObject >= 5.0.0. The function now gracefully falls back to `do_FeaturePlot()` with an informative message when using newer SeuratObject versions, ensuring uninterrupted workflow.
-   Packaging & documentation: Removed `waffle` from `Suggests` by implementing an internal waffle rendering in `do_WafflePlot()` using `ggplot2`. Replaced `\link[liana]{...}` cross-references with inline `\code{...}` mentions and removed `liana` from `Suggests`.
-   Fixed bug in `do_DimPlot()` where using `label = TRUE` with `label.box = TRUE` would cause an error when attempting to add a fill scale that didn't exist. The internal `add_scale()` function now checks for scale existence before removal.
-   Fixed bug in `do_DotPlot()` where the `cluster` parameter was clustering both features and identities, contrary to its documentation. Renamed `cluster` to `cluster.identities` and added `cluster.features` parameter for explicit control. Both default to `FALSE`.
-   Fixed bug in `do_TermEnrichmentPlot()` where y-axis labels were derived from the original unfiltered data instead of the filtered/ordered terms, causing label mismatches. Labels now correctly correspond to the displayed terms.
-   Fixed a bug in `do_ActivityHeatmap()` where asserthat calls would trigger an error regardless of the condition being met or not.

# SCpbur v3.0.0 

## Reason for the mejor version change
-   Due to the preparation for the publication of SCpubr's manuscript, a major effort has been made to further standardize and wrap up the package nicely.
-   Some functions have been removed, and many have been renamed, for consistency.
-   Development version of functions have been transferred to the normal release, with the exception of `SCpubr::do_SavePlot()`.

## General
-   Enhanced startup message for clarity. Not it guides the user to run `SCpubr::package_report(extended = TRUE)` to get an overview of the missing dependencies.
-   Added black border to glyphs in legends.
-   Whenever a categorical color scale is used, now you can set `colorblind = TRUE`, and it will pull from a collection of different published colorblind-safe palettes. If the length of the classes in the categorical variable matches the length of one of the palettes, that palettes is used. If not, a pool will be selected, with a total maximum of 85 categories allowed. If `colors.use` is used, `colorblind` has no effect (thus, check if your palette is colorblind-safe with `do_ColorBlindCheck()`). For continuous variables, `YlGnBu` is used. For divergent variables, `RdBu` is used. Both `YlGnBu` and `RdBu` are colorblind-safe. Since they are set as default, there is no need for `colorblind` parameter in the functions that only plot continuous/divergent variables.
-  Added support to show the values as text in most heatmap-based functions. This is achieved by using `values.show = TRUE`.
-  Aesthetics of the text labels can be tuned with `values.threshold`, `values.size` and `values.round`. 
-  Fixed an issue where `symmetry_center` would not work as intended. Now it correctly displays the color scale with the provided value in the center.

## Added functions
-   `do_WafflePlot()`: This function displays proportions as a pictogram grid of 10x10 tiles. It helps to visually see at a glance the proportions of your data. This fails to correctly convey decimal proportions and completely ignores heavily under-represented classes in your dataset. 
-   `do_RankedExpressionHeatmap()` to plot expression values as a heatmap along a dimensional reduction component.
-   `do_ColorBlindCheck` to provide a comparative view of a given color paletter under different kinds of color blindness. This will allow to check for the suitability of a given set of colors for publication.

## Removed functions
-   `do_FunctionalAnnotationPlot()`.
-   `do_GroupedGOTermPlot()`.

The reason behind it is that they, together with do_TermEnrichmentPlot() targeted the same analysis and, therefore, were redundant.

## Renamed functions
In an effort to standardize function names, the following changes have been implemented: 

-   `do_DiffusionMapPlot()` is now called `do_RankedEnrichmentHeatmap()`. 
-   `save_plot()` (development release only) is now called `do_SavePlot()`. 
-   `package_report()`  is now called `do_PackageReport()`. 
-   `do_LoadingsPlot()` is now called `do_LoadingsHeatmap()`. 
-   `do_AffinityAnalysisPlot()` is now called `do_ActivityHeatmap()`. 
-   `do_PathwayActivityPlot()` is now called `do_PathwayActivityHeatmap()`. 
-   `do_TFActivityPlot()` is now called `do_TFActivityHeatmap()`.
-   `do_GroupwiseDEPlot()` is now called `do_GroupwiseDEHeatmap()`. 
-   `do_CopyNumberVariantPlot()` is now called `do_CNVHeatmap()`. 
-   `do_CorrelationPlot()` is now called `do_CorrelationHeatmap()`. 
-   `do_MetadataPlot()` is now called `do_MetadataHeatmap()`. 
-   `do_GeyserPlot()` is now called `do_StripPlot()`. 

## Heavily modified functions.
-   `do_TermEnrichmentPlot()`: Recoded the whole function. Now accepts the result of using `clusterProfiler::enrichGO()`, `clusterProfiler::enrichKEGG()`, etc. The output is a dot plot with the terms on the Y axis, the Gene Ratio in the X, colored by the adjusted p-value and size mapped to the Gene Count.
-   `do_DotPlot()`: Removed dependencies with `Seurat::DotPlot()`.
-   `do_RankedEnrichmentPlot()`, `do_EnrichmentHeatmap()` and `do_SCEnrichmentHeatmap()` do not longer accept `flavor = "AUCell"` due to dependency issues and lack of development support.

The reason of these modification is to allow for a much clearer and concise output than before.

## do_ActivityHeatmap()
-   Changed legend title to "Z-Scored | ulm score", for consistency with other functions in the package.

## do_AlluvialPlot()
-   Enforced a minimum version of `ggalluvial` to deal with deprecation of functions from `dplyr` and `tidyr` that were still used in `ggalluvial` functions.
-   Modified the legend items to have a black border.
-   Changed default legend position to bottom and legend title to top and centered.

## do_BoxPlot()
-   Added `legend.ncol`, `legend.nrow` and `legend.byrow` parameters to control legend behavior.
-   Fixed a bug in which `map_signif_levels` would only accept a logical and not custom mappings.
-   When `map_signif_levels` is used, the mapping now appears as a plot legend for clarity.
-   Added black borders to the legend glyphs when using `use_silhouette = FALSE`. 

## do_CellularStatesPlot()
-  Added reference lines to the plot to better visualize the segments.
-  Added black border around the legend items. 
-  Fixed bug where axis text will always display in bold. 

## do_ChortDiagramPlot()
-  Added `font.size` parameter to control the font size of the plot.

## do_CNVHeatmap()
-   Added `include_chr_arms` parameter to decide whether the heatmap should include a breakdown of the arms or just keep it by chromosomes.

## do_ColorPalette()
-  Changed "Wheel" to "Color wheel" when plotting the output without additional parameters.

## do_DimPlot()
-   Fixed a bug caused by using `cells.highlight` with only one cell.
-   Fixed a bug causing the "Combined" plot resulting of the use of `split.by` and `group.by` to have a different size than the rest of panels when `ncol` parameter was also used.
-   Fixed a bug causing a "selected_cells" plot title to show up when using `cells.highlight` and `idents.highlight`. 
-   Changed the plot title of the "Combined" plot to either `group.by` or `split.by` depending of the usage context.
-   Added `split.by.combined` parameter and set its default value to `TRUE`. This allows to toggle on or off whether to display the combined view when `split.by` is used.
-   However, when `split.by`is used alongside `group.by`, it is now enforced to show the combined plot (`split.by.combined = TRUE`), to avoid bugs.
-   Added `legend.dot.border` parameter to select whether we want a black border around the legend dots or not.
-   Fixed a bug in which `font.family` would not be applied when `label = TRUE`. 
-   Fixed a bug in which groups would not cluster if `cluster = TRUE` if there were missing values.

## do_DotPlot()
-   Fixed a bug that caused sequential palettes to not be checked properly.
-   Changed default value of `dot.scale` to 8.
-   Removed legacy parameter `colors.use`, which had no effect as of previous version but was still listed as parameter.
-   Removed dependency with `Seurat::DotPlot()`. This means that there will be some differences with the output of this function. However, this is a design choice for the sake of preventing future dependency problems.
-   Added `split.by` parameter.
-   If `features` is provided as a named list, the plot facets them based on the belonging list (duplcated genes are removed). Cannot be used alongside `split.by`.
-   Removed `scale`and `scale.by` parameters. In the sense of how they worked in `Seurat`.
-   Added `zscore.data` parameter. When set to `TRUE`, it computes Z-scores for each gene across the different groups, allowing for inspection of which group has highest or lowest expression, but prevents you from comparing values across different genes. It is intended to be used alongside `slot = "data"`. 
-   Removed the possibility to use a list of features. Instead, facets are being drawn according to `split.by` parameter.
-   Removed `dot_border`. This is a design choice of `SCpubr`.
-   Added `dot.min` parameter to exclude dots falling below a threshold for `P.Exp`.

## do_EnrichmentHeatmap()
-   Changed default value of `scale_scores` to `FALSE`.
-   Fixed a bug in which scores were not actually being scaled when `scale_scores = TRUE`.
-   Fixed a bug in which setting `scale_scores = TRUE` and `features.order` would trigger an error since the output had the suffix `_scaled` on it. This has been patched.

## do_FeaturePlot()
-   Fixed a bug in which legend titles would not show up as intended.
-   Enabled the use of several legend titles when multiple features are provided. The number of legend titles and features have to be equal.
-   Fixed a bug in which `font.family` would not be applied when `label = TRUE`. 
-   Added `scale.limits` parameter to control the range of values the color scale should take. This is specially useful if you want to plot several features and make the color comparable between them. 

## do_GroupwiseDEHeatmap()
-   Reduced the legend title texts to allow for more room in the plot.
-   Fixed a bug in which providing a DE genes object with `p_val_adj = 0` would cause the function to crash.

## do_LigandReceptorPlot()
-   Added a new parameter `top_interactions_by_group` which when set to `TRUE` will report for each pair of `source` and `target`, as many interactions as stated in `top_interactions`.

## do_MetadataHeatmap()
-   Modified the legend items to have a black border.
-   Set `cluster = FALSE` as default.

## do_PathwayActivityHeatmap
-   Changed legend title to "Z-Scored | <statistic> score", for consistency with other functions in the package.

## do_RidgePlot()
-   Removed `size = 1.25` aesthetic from the call to `ggridges::geom_ridge...`.
-   Set default legend position to bottom.
-   Fixed a bug in which plot grid would not react properly to `flip`.
-   Simplified the functionality of the function due to inconsistent interactions with `ggridges` package. As such, parameters `compute_quantiles`, `compute_custom_quantiles`, `quantiles`, `compute_distribution_tails`, `prob_tails` and `color_by_probabilities` are removed. 

## do_SavePlot()
-   Added `limitsize` parameter, that allows for very big ggplot2-based plots to be saved with big dimensions.

## do_TFActivityHeatmap()
-   Changed legend title to "Z-Scored | <statistic> score", for consistency with other functions in the package.

## do_ViolinPlot()
-   Added `order` parameter to reorder the groups based on the median. Only works when `split.by` is set to `NULL`.
-   Fixed typos in error logging.
-   Fixed a bug in which color palettes would not display by default when using `split.by`.

## do_VolcanoPlot()
-   Fixed an issue in which tags would be duplicated when using `use_labels = TRUE` in combination with `order_tabs_by = "both"`.
-   Renewed aesthetics.
-   Parameter `colors.use` now defaults to `NULL`, allowing a default color scheme to take place. Setting this parameter to a color will modify the color scheme appropriately.
-   Simplified axis titles. 

# SCpbur v2.0.2

## General.
-   Fixed a bug that prevented error messages stating the dependencies missing per function to show up properly.
-   Fixed assumptions on Seurat v4 and v5 and reverted to the use of cannonical `GetAssayData` and `SetAssayData` functions.
-   Fixed dependency problems with archived packages.

## do_BeeSwarmPlot()
-   Changed default continuous palette to `YlGnBu`.
-   Changed default legend title to `feature_to_rank` if `continous_feature = TRUE`. 
-   Changed default value of `sequential.direction` to `1`. 
-   Changed default value of `legend.position` to `bottom` when `continuous_feature = FALSE`. 

## do_BoxPlot()
-   Changed default value of `legend.position` to `bottom`. 
-   Fixed a bug in which legend key glyphs would not show up when using `use_silhouette = TRUE`. 

## do_CopyNumberVariantPlot()
-   Fixed an issue in which using `min.cutoff` or `max.cutoff` would render the values outside these bounds to NA and therefore being plotted as grey. Now they will have the highest/lowest value possible.

## do_FeaturePlot()
-   Added `symmetry.type` parameter, that allows to control how the symmetry is computed: either in absolute values (taking into account the highest and lowest value) or in the middle point specified by `symmetry.center`.
-   Added `symmetry.center` parameter, that allows to control the center of symmetry when `symmetry.type` is set to `centered`. 

## do_ViolinPlot()
-   Changed default value of `legend.position` to `bottom`. 
-   Fixed a bug in which the default color palette would not be applied when `plot_boxplots = FALSE`.
-   Added `legend.title.position` parameter and set it up as `top` by default.
-   Fixed a bug in which plot grid would not react properly to `flip`.

# SCpubr v2.0.1 

## General
-   Refactored startup messages to comply with CRAN policies.

## Removed functions
-   Removed `SCpubr::check_dependencies()` to support the use of `SCpubr::package_report()`. 

## `SCpubr::do_EnrichmentHeatmap`

-   Fixed a bug that checked the package dependencies for the wrong function.

# SCpubr v2.0.0 

This major update focus on a complete re-implementation of all heatmap-based functions into `ggplot2` instead of `ComplexHeatmap`. This will lead to many of the existing code to break. The trade-off between the difficulty of debug, expand and maintain the existing heatmap-based functions with regards to the capabilities ComplexHeatmap offers with regards to ggplot2 was not worthy.

All heatmap-specific parameters have been replaced with the overarching parameters that are used across functions. This decision was taking after a lot of thought, but ultimately, having all plots rely on ggplot2 makes it way more compatible to work with them together, to debug, and to further implement new ideas.

Many (except a few selected cases) of the functions that returned list of different plots have been modified to return a single (and most important/relevant) plot and the option to return the Seurat object with the data generated added to it has been implemented so that the user can still generate plots with it. This goes in line with the fact that having so many interconnected functions made it very difficult to expand on them, if needed, as the downstream effects will cascade to other functions as well.

## Parameter renaming

-   Changed `viridis_color_map` to `viridis.palette`.
-   Changed `viridis_direction` to `viridis.direction`.
-   Changed `sequential_direction` to `sequential.direction`.
-   Changed `rotate_x_axis_labels` to `axis.text.x.angle`.
-   Changed `rotate_strip_text` to `strip.text.angle`.

## New functions (available on the development build for extended texting)

-   `SCpubr::do_MetadataPlot()` to generate metadata heatmaps with ease both from Seurat object or from a data frame. Will be first released as part of the `development version` and then released in CRAN as part of future updates. The idea is to gather feedback from users before officially releasing it.
-   `SCpubr::do_SCExpressionHeatmap()` to generate heatmaps of expression of genes across all cells in the dataset. Will be first released as part of the `development version` and then released in CRAN as part of future updates. The idea is to gather feedback from users before officially releasing it.
-   `SCpubr::do_SCEnrichementHeatmap()` to generate heatmaps of enrichment of genes across all cells in the dataset. Will be first released as part of the `development version` and then released in CRAN as part of future updates. The idea is to gather feedback from users before officially releasing it.
-   `SCpubr::do_AffinityAnalysisPlot()` to assess the affinity of gene sets to subset of cells in the Seurat objects using the weighted means algorithms from DecoupleR. Will be first released as part of the `development version` and then released in CRAN as part of future updates. The idea is to gather feedback from users before officially releasing it.
-   `SCpubr::do_LoadingsPlot()` to generate a summary heatmap of the PCA loadings (top and bottom scored genes for each PC) together with a expression heatmap of the same genes. Will be first released as part of the `development version` and then released in CRAN as part of future updates. The idea is to gather feedback from users before officially releasing it.
-   `SCpubr::do_DiffusionMapPlot()` to analyze the output of a diffusion map analysis on the context of enrichment in gene sets used for the generation of the diffusion map. Will be first released as part of the `development version` and then released in CRAN as part of future updates. The idea is to gather feedback from users before officially releasing it.
-   `SCpubr::check_dependencies()` to generate a per-function summary of the needed packages to run the function. The report has been enhanced with `cli` package and now clearly illustrates what is missing to run the function.

## Removed functions

-   `SCpubr::do_SankeyPlot()` has been removed and replaced by `SCpubr::do_AlluvialPlot()`, which is present in the official CRAN versions.
-   `SCpubr::do_PseudotimePlot()` has been removed indefinitely until a better, revamped, state-of-the-art version is generated.
-   `SCpubr::do_AzimuthAnalysisPlot()` has been removed as the output can be accomplished by a combination of the current functions in `SCpubr`. A vignette will be added to reproduce the same analysis.

## General

-   Now when using `min.cutoff` or `max.cutoff`, the legend will show that the min/max value is higher/lower than the one provided, if such value appeared originally in the legend breaks. This potentially interacts with `enforce_symmetry`.
-   Added `number.breaks` parameter to control the number of breaks in the legend of ggplot2-based plots. It will not always work, as the function will try to fit the breaks accordingly. But still, will give some range of freedom to the user.
-   Removed `colorsteps` from `legend.type` parameters as it was prone to generate unintended bugs.
-   Changed default values from `min.cutoff` and `max.cutoff` from `NULL` to `NA`.
-   Implemented `diverging.palette` parameter in all plots that have a symmetrical color scale to help selecting other possible color scales for the plot.
-   Implemented `sequential.palette` parameter in all plots that have a continuous, non-symmetrical color scale to help selecting other possible color scales for the plot, in the case the user does not want to use viridis color scales.
-   Renamed `SCpubr::state_dependencies()` to `SCpubr::check_dependencies()`.
-   Renewed printed messages at startup and while running functions using `cli` package.
-   Added the complete control of the font style of plot titles, subtitles, captions, axis titles, axis text, legend titles and legend text. For this, the following parameters have been added to all ggplot2-based functions:
    -   `plot.title.face`: To control the style of the **title**.
    -   `plot.subtitle.face`: To control the style of the **subtitle**.
    -   `plot.caption.face`: To control the style of the **caption**.
    -   `axis.title.face`: To control the style of the **axis title**.
    -   `axis.text.face`: To control the style of the **axis text**.
    -   `legend.title.face`: To control the style of the **legend title**.
    -   `legend.text.face`: To control the style of the **legend text**.
-   Changed default font style for legend text from `bold` to `plain`. 
-   Changed default font style for axis text from `bold` to `plain`.
-   When using `plot.axes = TRUE` parameter in `SCpubr::do_DimPlot()`, `SCpubr::do_FeaturePlot()` and `SCpubr::do_NebulosaPlot()`, now the entirety of the X and Y axis is removed, titles included.
-   Remove plot margin padding in `SCpubr::do_DimPlot()`, `SCpubr::do_FeaturePlot()` and `SCpubr::do_NebulosaPlot()`. 

## `SCpubr::do_AlluvialPlot`
-   Added `sequential.palette` and `sequential.direction` parameters.

## `SCpubr::do_BarPlot`

-   Added `facet.by` parameter to extra group the bars by a third metadata variable.
-   Added `order.by` to reorder the bars when using `position = fill` based on a value in `group.by`.
-   Limited the possible interactions from `group.by`, `split.by` and `order.by` to those that make sense to plot. For instance, a bar plot using `group.by` and `position = fill` but not using `split.by ` resulted in bars of equal lenght with only one value per group of proportion `1`.
-   Set default value of `plot.grid` to `FALSE`.
-   Added parameter `add.n` to display the total count on top when `position = fill`.
-   Added parameter `add.n.face` to control the appearance of the text displayed.
-   Added parameter `add.n.expand` to control the range of values in the Y axis. This has to be minimum 0 and maximum at least 1. This is set in order to tweak the limits so that the labels fit when `flip = TRUE`.

## `SCpubr::do_BeeSwarmPlot`

-   Added `order` parameter to reorder the groups based on the median rank.

## `SCpubr::do_BoxPlot`

-   Changed the reordering of boxplots based on the median rather than the mean.
-   Added `na.rm` to `geom_boxplot` to avoid unnecessary warnings when introducing NAs as part of the data.
-   Fixed a bug in which `order` would not work if `NAs` are in the data.
-   Changed default value of `boxplot.linewidth` from `1` to `0.5`.
-   Fixed a bug in which when using a combination of `group.by` and `split.by`, the package would check that the colors provided to `colors.use` need to match the values in `group.by` and not `split.by`.

## `SCpubr::do_CorrelationPlot`

-   Added parameter to fix a bug in which viridis scales did not apply due to the lack of the parameter.
-   Added `min.cutoff` and `max.cutoff` parameter to add cutoffs to the scales.
-   Added `mode = "jaccard"` to compute a correlation matrix of a list of gene sets based on jaccard similarity.
-   Added `use_viridis`, `sequential.palette` and `sequential_direction` and `diverging.palette` to control color palettes.
-   Added `cluster` parameter to toggle on/off the clustering of the rows and columns in the heatmap.
-   Added `remove.diagonal` parameter to toggle on/off the conversion of the diagonal in the correlation matrix to `NA`.
-   Fixed several issues with setting cutoffs for the color scale using `min.cutoff` and `max.cutoff`. 
-   Fixed an issue where `number.breaks` will not work in `mode = "jaccard"`.

## `SCpubr::do_CopyNumberVariantPlot()`

-   Removed the option to compute Feature and Geyser plots.
-   Instead, a new paramerter `return_object` has been added to return the Seurat object with a new assay containing the CNV scores per cell on the `data` slot of the `CNV_scores` assay.
-   The main output visualization is now a heatmap with the averaged scores by chromosome and groups and also by chromosome arms.

## `SCpubr::do_DimPlot`

-   Modified underlying code to correctly display borders around cells when `cells.highlight` or `idents.hightlight` or `idents.keep` are used. Also removed the "Not selected" item from the legend when doing so, as it was redundant.
-   Fixed a bug in which multiple legend would appear when using a combination of `group.by` and `split.by`, given that the individual UMAPs would not have the same number of entities to plot and color.

## `SCpubr::do_DotPlot`

-   Added `scale` parameter to allow for the data to be scaled or not scaled.
-   Removed `split.by` parameter in favor or the higher consistency and proper functionality accross parameters. Will probably come in the future, implemented outside of the umbrella of Seurat.
-   Renamed parameter `cluster.idents` to `cluster`.
-   Removed the limitation of `flip` when `features` was a list of genes. Now any combination of `flip` and `features` is possible.

## `SCpubr::do_EnrichmentHeatmap`

-   Removed options to plot FeaturePlots, GeyserPlots, ViolinPlots, etc. - together with its related parameters. For the sake of simplicity in the function and its use, the user can get the Seurat object back with `return_object = TRUE` and plot the enrichment scores separately, that are stored as a new Assay.
-   Removed `return_matrix` parameter as the scores can now be retrieved from the Seurat object as an assay.
-   Enforcing the use of `named lists` as input for the function.
-   Added `cluster` parameter to allow for clustering of rows and columns.
-   Added `groups.order` to allow for specifically arrange the groups defined by `group.by` with a given order.
-   Added `features.order` to allow for specifically arrange the gene sets defined by `input_gene_list`.

## `SCpubr::do_ExpressionHeatmap`

-   Added `cluster` parameter to allow for clustering of rows and columns.
-   Added `groups.order` to allow for specifically arrange the groups defined by `group.by` with a given order.
-   Added `features.order` to allow for specifically arrange the features defined by `features`.

## `SCpubr::do_FeaturePlot`

-   Modified underlying code to show a border around selected cells when using `split.by`, `cells.hightlight` and `idents.highlight`.
-   Added parameter `border.density` to reduce the amount of extra cells drawn on the background to generate the borders. This will be a number between 0 and 1 corresponding to the quantile of the distribution of density of the points in the scatterplot drawn in the background. The lower the value, the harder it will be to keep a border around all cells, while it will significantly reduce the overall weight of the plot object.
-   Added parameter `group.by`, that allows to plot a big dot in the center of each group designated by `group.by` and thus allowing to locate easily where each identity is in the FeaturePlot. Also, plots a legend matching the color of the dots. This can be tweaked with additional parameters such as:
-   `group.by.show.dots` to controlw hether these dots are plotted or not (to allow only plotting colored borders around cells - see below).
-   `group.by.dot.size` to control the size of the introduced dots.
-   `group.by.cell_border` to plot another contour-like border which also displays the color coding of the clusters designated by `group.by`, to signal the reach of each cluster. However, this basically signals the cluster the cells in the periphery of the cell blobs belong to. Take that into account.
-   `group.by.cell_borders.alpha` controls the alpha of the new cell borders.
-   `group.by.legend` controls the legend title of the new legend.
-   Renamed `split.by.idents` to `idents.keep` to better synergize with the parameter in `SCpubr::do_DimPlot`. Only works when `split.by` is used.

## `SCpubr::do_FunctionalAnnotationPlot`

-   Removed the tree plots as they proved to behave inconsistently across datasets and the quality of visualizations were compromised.
-   Removed the option to plot the bar plots and dot plots in the sake of a more simplified, streamlined plot generation.
-   The option to return the result matrix using `return_matrix` is added, so that the user can use it to compute further analysis or visualizations.

## `SCpubr::do_FunctionalAnnotationPlot`
-   Renamed `order_by_mean` to `order`.
-   Ordering using `order = TRUE` now is done based on the median instead of the mean.

## `SCpubr::do_LigandReceptorPlot()`
-   Modified the accepted input so that only the result of `liana::liana_aggregate()` is taken into account.
-   Removed `arrange_interactions_by` as now the function only accepts the output of `liana::liana_aggregate()`.
-   Added a `sort.by` parameter instead to select how the output of `liana::liana_aggregate()` should be ordered prior the subset by `top_interactions`. Five modes are available:
    - `A`: Orders the output by `specificity`.
    - `B`: Orders the output by `magnitude`.
    - `C`: Orders the output by `specificity` then `magnitude`. This prioritizes the `specificity` column.
    - `D`: Orders the output by `magnitude` then `specificity`. This prioritizes the `magnitude` column.
    - `E`: Orders the output by `specificity` and `magnitude` providing equal weights to both columns.
-   Removed `flip` parameter as the output was prone to errors.
-   Removed parameter `compute_ChordDiagrams` and added `return_interactions`. This parameter returns two tibbles that can be used alongside `SCpubr::do_ChordDiagramPlot` to plot the diagrams. 
-   Now the filtering applied by using `keep_source` and `keep_target` takes place before subsetting for the top N interactions defined by `top_interactions`. This ensures that, if the user wants to focus on a given interaction subset, we retrieve the most important interactions for the subset.
-   Added `magnitude` and `specificity` columns to allow the user to choose which variables to use for plotting.
-   Added `sorting.type.magnitude` and `sorting.type.specificity` to allow the user to choose how the columns are sorted prior plotting.
-   Added `invert_magnitude` and `invert_specificity` to allow the user to choose how the data is displayed for columns that tend to 0. Inverting performs a `-log10` transformation on the column.
-   Added a `verbose` parameter and set it to `TRUE` by default to inform the user of the arrangements taking place in the output of `liana::liana_aggregate()` prior plotting.

## `SCpubr::do_PathwayActivityPlot()`

-   Removed the option to plot geyser and feature plots to simplify the use (and computational time) of the function.
-   Introduced `return_object` parameter that returns the Seurat object with the new assay to use for other plotting purposes (such as Geyser and Feature plots).
-   Removed options to plot FeaturePlots, GeyserPlots - together with its related parameters. For the sake of simplicity in the function and its use, the user can get the Seurat object back with `return_object = TRUE` and plot the scores separately.
-   Added `slot` parameter to decide whether to plot scale data or not.
-   Fixed bug in which after setting `enforce_symmetry = FALSE` the color palette used was `diverging.palette` instead.

## `SCpubr::do_TFActivityPlot()`

-   Removed the option to plot geyser and feature plots to simplify the use (and computational time) of the function.
-   Introduced `return_object` parameter that returns the Seurat object with the new assay to use for other plotting purposes (such as Geyser and Feature plots).
-   Removed options to plot FeaturePlots, GeyserPlots - together with its related parameters. For the sake of simplicity in the function and its use, the user can get the Seurat object back with `return_object = TRUE` and plot the scores separately.
-   Added `slot` parameter to decide whether to plot scale data or not.
-   Fixed bug in which after setting `enforce_symmetry = FALSE` the color palette used was `diverging.palette` instead.

# SCpubr v1.1.2

More hotfixes in unit tests to comply with CRAN checks.

# SCpubr v1.1.1

Hotfixes in unit tests to comply with CRAN checks.

# SCpubr v1.1.0

## General

-   Increased the cell size of all heatmap-based functions from 5 to 8.
-   Decreased the thickness of frame and ticks of all ggplot2-based continuous legends to retrieve a similar behavior as in previous versions of ggplot2, as with the new update, the overall thickness of the frame and ticks increased, probably due to the changes related to `element_line`,
-   Added five new functions: `do_AlluvialPlot()`, `do_AzimuthAnalysisPlot()`, `do_ExpressionHeatmap()`, `do_GroupedGOTermPlot()` and `do_FunctionalAnnotationPlot()`.
-   Added `legend.ncol`, `legend.nrow`, `legend.title` and `legend.byrow` to as many functions as possible to further customize legend appearance.

## `SCpubr::do_BeeSwarmPlot()`

-   Added `min.cutoff` and `max.cutoff` parameter.
-   Added ticks to the plot, that were missing.
-   Added missing axes titles.
-   Added `viridis_direction` parameter to control how the continuous color scale is formed.
-   Added `return_object` parameter to return the Seurat object with the enrichment scores computed.
-   Added BoxPlots, BeeSwarmPlots and ViolinPlots to the possible outputs the user can choose from.
-   Make `legend.position` conditional of whether `continuous_feature` is set to TRUE. If it is false, legend is not displayed unless the user specifies otherwise.

## `SCpubr::do_BarPlot()`

-   Fixed a bug in which axes titles were not displaying correctly under certain combinations of `flip` and `split.by`.
-   Fixed a bug in which `x_lab` and `y_lab` would not rotate accordingly when using `flip = TRUE`.

## `SCpubr::do_BeeSwarmPlot()`

-   Adapted the code to the new 0.7.1 version of the package, thus deprecating the `groupOnX` parameter of `geom_quarirandom`. This will likely affect users with a lower version.
-   A warning has been placed for the users in lower versions of the need to upgrade to 0.7.1.
-   This changes are subject to the new behaviors/deprecations of ggplot2 and ggplot2.

## `SCpubr::do_BoxPlot()`

-   Set `assay` to NULL and will default to the default assay in the seurat object.

## `SCpubr::do_CellularStatesPlot()`

-   Fixed a bug that prevented FeaturePlots to have symmetrical axes with respect to the main plot.

## `SCpubr::do_CorrelationPlot()`

-   Added `viridis_direction` parameter.

## `SCpubr::do_DimPlot()`

-   Fixed a bug in which the legend title will not show up in regular basic plots even though the parameter `legend.title` was used.
-   Completely reformatted the way `split.by` works, so that now only one legend is displayed for the whole group and cells have border.
-   Added `label.size` and `label.box` parameters for further customize the appearance of the plot when using `label = TRUE`.
-   Changed `repel` to `FALSE` by default.

## `SCpubr::do_EnrichmentHeatmap()`

-   Fixed a bug in the code that prevented the feature plots and the geyser plots to be computed if the input gene list was not a named list of genes.
-   Added `flavor = "AUCell"`, that lets the user compute AUCell scoring of the gene sets.
-   Added the option to query multiple `group.by` parameters at the same time.
-   Fixed a bug in the code that prevented multiple outputs with different values of `group.by` to be returned properly, leading to the last value of `group.by` replacing all the rest.

## `SCpubr::do_FeaturePlot()`

-   Added `label`, `label.size` and `label.color` parameter to reproduce the same behavior as in `Seurat::FeaturePlot()`.

## `SCpubr::do_GroupwiseDEPlot()`

-   Set `assay` to NULL and will default to the default assay in the seurat object.

## `SCpubr::do_LigandReceptorPlot()`

-   Added `arrange_interactions_by` to control how output interactions are arranged (either by aggregate_rank, specificity, magnitude or a combination of magnitude and specificity).
-   Added `sort_interactions_alphabetically` to control whether the output dotplot has the interactions ordered alphabetically or as they come in the original matrix (meaning, they follow the arrangement specified in `arrange_interactions_by`). (([liana's issue #72](https://github.com/saezlab/liana/issues/72)))

## `do_PathwayActivityPlot()`

-   Added a fix in which when `enforce_symmetry` is set to `FALSE`, then the color scale turns into a viridis-based one instead of a two-color gradient scale.

## `do_TFActivityPlot()`

-   Added a fix in which when `enforce_symmetry` is set to `FALSE`, then the color scale turns into a viridis-based one instead of a two-color gradient scale.

## `SCpubr::do_ViolinPlot()`

-   Fixed a bug in the code in which no different colors could be passed to `colors.use`.
-   Reduced default line width from 1 to 0.5.

# SCpubr v1.0.4

-   Hotfix for v1.0.3 in which `do_GeyserPlot` with categorical variables had a bug that mapped the legend to the continuous axis.

# SCpubr v1.0.3

## General changes

-   Added `min.cutoff` and `max.cutoff` parameter to effectively subset the color scale and remove the effect of extreme outliers in all ComplexHeatmap-based functions.
-   Added `min.cutoff` and `max.cutoff` parameter to effectively subset the color scale and remove the effect of extreme outliers in all ggplot2-based functions susceptible to be biased by outliers.

## `SCpubr::do_DimPlot()`

-   Implemented a change in which when using `split.by` and `group.by` in combination, the cells colored on top of the UMAP also have a border.
-   Implemented a bug-fix in which when using `split.by` and `group.by` in combination, the extra new layers would not raster if `raster = TRUE`.
-   Implemented a bug-fix in which when using `split.by` and `group.by` in combination, no plots will appear if `ncol` is set.
-   Implemented a new feature to add density line contours using `plot_density_contour`.
-   Implemented the conditional use of `raster.dpi` to Seurat versions higher or equal to 4.1.0.

## `SCpubr::do_EnrichmentHeatmap()`

-   Implemented a bug fix for internal checks in the function.
-   Added `plot_FeaturePlots` and `plot_GeyserPlots` to also report the enrichment scores in a gene set-based manner.
-   Added `flavor` parameter, that accepts `Seurat` and `UCell` to allow for different enrichment scoring methods. It requires `R 4.2.0` to run.
-   Renamed `symmetrical_scale` to `enforce_symmetry` to have a greater coherence across functions.

## `SCpubr::do_FeaturePlot()`

-   Implemented a new feature to add density line contours using `plot_density_contour`.
-   Implemented the conditional use of `raster.dpi` to Seurat versions higher or equal to 4.1.0.

## `SCpubr::do_GeyserPlot()`

-   Fixed bug in which internal parameter names made it to the X axis title.
-   Removed `color.by` implementation due to it being very buggy. This will be re-implemented in a future patch.

## `SCpubr::do_RidgePlot()`

-   Implemented a bug-fix in which using `assay = "RNA"` or, in fact, any other assay rather than `SCT` will result in an error.

## `SCpubr::do_ViolinPlot()`

-   Corrected a bug in which legend title when using `split.by` was an actual line of code.
-   Added `legend.title` parameter to control the title of the legend.

### SCpubr v.1.0.3-dev-stable

-   Same as v1.0.3, but with all the functions that do not pass CRAN checks. These functions are: `SCpubr::save_Plot()` `SCpubr::do_LigandReceptorPlot()` and `SCpubr::do_SankeyPlot()`.

# SCpubr v1.0.2

## General changes

-   Change color palette when using `enforce_symmetry = TRUE` to have the middle color as `grey95` instead of the previous one, which made middle values seem closer to the positive end of the scale.
-   Modified internal structure of all functions to abide with [tidyselect v1.2.0 lifecycle modifications](https://tidyselect.r-lib.org/news/index.html#lifecycle-changes-1-2-0).
-   Modified `rotate_x_axis_labels` parameter in all functions that made use of it. Now, instead of accepting a `logical`, accepts a `numeric`: either `0`, `45` or `90`, corresponding to the degrees in which the X axis labels should be rotated. ([#5](https://github.com/enblacar/SCpubr/issues/5#issuecomment-1289203453))

## `SCpubr::do_CopyNumberVariantPlot`

-   Modified the code for `SCpubr::do_CopyNumberVariantPlot` to also report results for the whole chromosome as well as for each chromosome arm.
-   Include the `verbose` argument to `SCpubr::do_CopyNumberVariantPlot` to silence the messages when there are not enough genes in the chromosome to perform the analysis.

## `SCpubr::do_DimPlot()`

-   Fixed a typo that prevented labels to be bold in `SCpubr::do_DimPlot()` when cell borders are displayed.
-   Added `group.by` and `split.by` functionality to `SCpubr::do_DimPlot()`. ([#4](https://github.com/enblacar/SCpubr/issues/4))

## `SCpubr::do_DotPlot()`

-   Added ticks to axes.
-   Modified default colors to convey a better aesthetic.

## `SCpubr::do_FeaturePlot()`

-   Fixed potential bugs in `SCpubr::do_FeaturePlot` when setting `enforce_symmetry = TRUE`.
-   Changed default value of `order` in `SCpubr::do_FeaturePlot()` from `TRUE` to `FALSE`.
-   Added `min.cutoff` and `max.cutoff` parameters to `SCpubr::do_FeaturePlot()`. This allows to effectively subset the color scale to the values provided. Cells outside the range will be converted to the min or max values provided, respectively. ([#2](https://github.com/enblacar/SCpubr/issues/2))

## `SCpubr::do_GeyserPlot()`

-   Added `flip` parameter.

## `SCpubr::do_GroupwiseDEPlot()`

-   Fixed bug in `SCpubr::do_GroupwiseDEPlot` in which the heatmap could not be computed. ([#3](https://github.com/enblacar/SCpubr/issues/3))
-   Added extra checks to ensure proper input in `SCpubr::do_GroupwiseDEPlot`. ([#3](https://github.com/enblacar/SCpubr/issues/3))

## `SCpubr::do_LigandReceptorPlot()` (development release)

-   Changed parameter `x_labels_angle` to `rotate_x_axis_labels` to keep a consistent terminology.

## `SCpubr::do_RidgePlot()`

-   Fixed a typo that made the lines in `panel.grid.minor` to be displayed in `SCpubr::do_Ridgeplot()`.
-   Added `flip` parameter.

## `SCpubr::do_ViolinPlot()`

-   Added `split.by` functionality to `SCpubr::do_ViolinPlot()`. ([#4](https://github.com/enblacar/SCpubr/issues/4), [#5](https://github.com/enblacar/SCpubr/issues/5))
-   Added `flip` parameter.
-   Now multiple features can be queried ad the same time. ([#5](https://github.com/enblacar/SCpubr/issues/5#issuecomment-1289203453))
-   Changed `feature` parameter to `features`, to better reflect the multiple feature behavior.
-   Recreated `Seurat`'s `share.y.lims` behavior and set it to `share.y.lims` parameter. ([#5](https://github.com/enblacar/SCpubr/issues/5#issuecomment-1289203453))

### SCpubr v1.0.2-dev-stable

-   Same as v1.0.2, but with all the functions that do not pass CRAN checks. These functions are: `SCpubr::save_Plot()` `SCpubr::do_LigandReceptorPlot()` and `SCpubr::do_SankeyPlot()`.

# SCpubr v1.0.1

-   Rework on unit tests and examples so that it can pass CRAN R CMD Check without packages in Suggests. This is, to make sure all Suggested packages are used conditionally.

## SCpubr v1.0.1-dev-stable

-   Same as v1.0.1, but with all the functions that do not pass CRAN checks. These functions are: `SCpubr::save_Plot()` `SCpubr::do_LigandReceptorPlot()` and `SCpubr::do_SankeyPlot()`.

# SCpubr v1.0.0

-   Modified internal checks so that the functions that do not use `Seurat` do not require this to be installed. This is just for the very side case in which somebody downloads the package just for the `SCpubr::do_ColorPalette()` function.
-   Removed the option to use `individual.titles`, 'individual.subtitles`and`individual.captions`in`SCpubr::do_NebulosaPlot()\` as the benefit of such parameters did not surpass the problems the code was causing. The feature might come back in the future, once fully optimized.
-   Removed `SCpubr::save_Plot()` function to align with CRAN policies that the package should not write to the file system. The code is still available in the v0.0.0.0.9000 release in Github.
-   Removed `SCpubr::do_LigandReceptorPlot()`, `SCpubr::do_SankeyPlot()` and `SCpubr::do_PseudotimePlot()` to align with CRAN policies and make it possible to publish the package. These functions can still be accessed in the v0.0.0.0.9000 release in Github.
-   Removed `SCpubr::do_PseudotimePlot()` for the reason above and because the dependency `Matrix.utils` was removed from CRAN on *09-10-2022*.

## SCpubr v1.0.0-dev-stable

-   Same as v1.0.0, but with all the functions that do not pass CRAN checks. These functions are: `SCpubr::save_Plot()` `SCpubr::do_LigandReceptorPlot()` and `SCpubr::do_SankeyPlot()`.

# SCpubr 0.0.0.9000

-   Added a `NEWS.md` file to track changes to the package.
-   Prepare package for submission to CRAN.


================================================
FILE: R/data.R
================================================
#' Chromosome arm locations for human genome GRCh38.
#'
#' A tibble containing the chromosome, arm and start and end coordinates.

#'
#' @format A tibble with 48 rows and 4 columns:
#' \describe{
#'   \item{chr}{Chromosome.}
#'   \item{arm}{Chromosome arm.}
#'   \item{start}{Start coordinates.}
#'   \item{end}{End coordinates.}
#' }
#' @usage data(human_chr_locations)
"human_chr_locations"


================================================
FILE: R/do_ActivityHeatmap.R
================================================
#' Compute affinity of gene sets to cell populations using decoupleR.
#'
#' Major contributions to this function:
#' - \href{https://github.com/MarcElosua}{Marc Elosua Bayés} for the core concept code and idea.
#' - \href{https://github.com/paubadiam}{Pau Badia i Mompel} for the network generation.
#'
#' @inheritParams doc_function
#' @param statistic \strong{\code{\link[base]{character}}} | DecoupleR statistic to use for the analysis.
#' values in the Idents of the Seurat object are reported, assessing how specific a given gene set is for a given cell population compared to other gene sets of equal expression.
#'
#' @return A list containing different plots.
#' @export
#'
#' @example /man/examples/examples_do_ActivityHeatmap.R

do_ActivityHeatmap <- function(sample,
                               input_gene_list,
                               subsample = 2500,
                               group.by = NULL,
                               assay = NULL,
                               slot = NULL,
                               statistic = "ulm",
                               number.breaks = 5,
                               values.show = FALSE,
                               values.threshold = NULL,
                               values.size = 3,
                               values.round = 1,
                               use_viridis = FALSE,
                               viridis.palette = "G",
                               viridis.direction = -1,
                               sequential.palette = "YlGnBu",
                               sequential.direction = 1,
                               diverging.palette = "RdBu",
                               diverging.direction = -1,
                               enforce_symmetry = TRUE,
                               legend.position = "bottom",
                               legend.width = 1,
                               legend.length = 20,
                               legend.framewidth = 0.5,
                               legend.tickwidth = 0.5,
                               legend.framecolor = "grey50",
                               legend.tickcolor = "white",
                               legend.type = "colorbar",
                               na.value = "grey75",
                               font.size = 14,
                               font.type = "sans",
                               axis.text.x.angle = 45,
                               flip = FALSE,
                               colors.use = NULL,
                               min.cutoff = NA,
                               max.cutoff = NA,
                               verbose = FALSE,
                               return_object = FALSE,
                               grid.color = "white",
                               border.color = "black",
                               flavor = "Seurat",
                               nbin = 24,
                               ctrl = 100,
                               plot.title.face = "bold",
                               plot.subtitle.face = "plain",
                               plot.caption.face = "italic",
                               axis.title.face = "bold",
                               axis.text.face = "plain",
                               legend.title.face = "bold",
                               legend.text.face = "plain"){
  # Add lengthy error messages.
  withr::local_options(.new = list("warning.length" = 8170))

  check_suggests("do_ActivityHeatmap")

  check_Seurat(sample)

  if (is.null(assay)){assay <- check_and_set_assay(sample)$assay}
  slot <- if(is.null(slot)){"data"} else {slot}

  # Check logical parameters.
  logical_list <- list("verbose" = verbose,
                       "flip" = flip,
                       "enforce_symmetry" = enforce_symmetry,
                       "use_viridis" = use_viridis,
                       "values.show" = values.show)
  check_type(parameters = logical_list, required_type = "logical", test_function = is.logical)
  # Check numeric parameters.
  numeric_list <- list("font.size" = font.size,
                       "legend.length" = legend.length,
                       "legend.width" = legend.width,
                       "legend.framewidth" = legend.framewidth,
                       "legend.tickwidth" = legend.tickwidth,
                       "subsample" = subsample,
                       "viridis.direction" = viridis.direction,
                       "axis.text.x.angle" = axis.text.x.angle,
                       "min.cutoff" = min.cutoff,
                       "max.cutoff" = max.cutoff,
                       "number.breaks" = number.breaks,
                       "sequential.direction" = sequential.direction,
                       "nbin" = nbin,
                       "ctrl" = ctrl,
                       "diverging.direction" = diverging.direction,
                       "values.threshold" = values.threshold,
                       "values.size" = values.size,
                       "values.round" = values.round)
  check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric)
  # Check character parameters.
  character_list <- list("group.by" = group.by,
                         "assay" = assay,
                         "slot" = slot,
                         "statistic" = statistic,
                         "legend.type" = legend.type,
                         "legend.position" = legend.position,
                         "legend.framecolor" = legend.framecolor,
                         "legend.tickcolor" = legend.tickcolor,
                         "font.type" = font.type,
                         "viridis.palette" = viridis.palette,
                         "diverging.palette" = diverging.palette,
                         "sequential.palette" = sequential.palette,
                         "grid.color" = grid.color,
                         "border.color" = border.color,
                         "flavor" = flavor,
                         "plot.title.face" = plot.title.face,
                         "plot.subtitle.face" = plot.subtitle.face,
                         "plot.caption.face" = plot.caption.face,
                         "axis.title.face" = axis.title.face,
                         "axis.text.face" = axis.text.face,
                         "legend.title.face" = legend.title.face,
                         "legend.text.face" = legend.text.face,
                         "na.value" = na.value)
  check_type(parameters = character_list, required_type = "character", test_function = is.character)

  `%>%` <- magrittr::`%>%`

  check_colors(grid.color, parameter_name = "grid.color")
  check_colors(na.value, parameter_name = "na.value")
  check_colors(border.color, parameter_name = "border.color")
  check_colors(legend.tickcolor, parameter_name = "legend.tickcolor")
  check_colors(legend.framecolor, parameter_name = "legend.framecolor")

  check_parameters(parameter = font.type, parameter_name = "font.type")
  check_parameters(parameter = legend.position, parameter_name = "legend.position")
  check_parameters(plot.title.face, parameter_name = "plot.title.face")
  check_parameters(plot.subtitle.face, parameter_name = "plot.subtitle.face")
  check_parameters(plot.caption.face, parameter_name = "plot.caption.face")
  check_parameters(axis.title.face, parameter_name = "axis.title.face")
  check_parameters(axis.text.face, parameter_name = "axis.text.face")
  check_parameters(legend.title.face, parameter_name = "legend.title.face")
  check_parameters(legend.text.face, parameter_name = "legend.text.face")
  check_parameters(viridis.direction, parameter_name = "viridis.direction")
  check_parameters(sequential.direction, parameter_name = "sequential.direction")
  check_parameters(diverging.direction, parameter_name = "diverging.direction")

  # Assign a group.by if this is null.
  out <- check_group_by(sample = sample,
                        group.by = group.by,
                        is.heatmap = TRUE)
  sample <- out[["sample"]]
  group.by <- out[["group.by"]]

  if (!is.na(subsample)){
    sample <- sample[, sample(colnames(sample), subsample)]
  }

  # Generate the continuous color palette.
  if (isTRUE(enforce_symmetry)){
    colors.gradient <- compute_continuous_palette(name = diverging.palette,
                                                  use_viridis = FALSE,
                                                  direction = diverging.direction,
                                                  enforce_symmetry = enforce_symmetry)
  } else {
    colors.gradient <- compute_continuous_palette(name = ifelse(isTRUE(use_viridis), viridis.palette, sequential.palette),
                                                  use_viridis = use_viridis,
                                                  direction = ifelse(isTRUE(use_viridis), viridis.direction, sequential.direction),
                                                  enforce_symmetry = enforce_symmetry)
  }


  # Generate a network with the names of the list of genes as source and the gene sets as targets with 1 of mode of regulation.
  # Step 1: Check for underscores in the names of the gene sets.
  if (length(unlist(stringr::str_match_all(names(input_gene_list), "_"))) > 0){
    warning(paste0(add_warning(), crayon_body("Found "),
                   crayon_key("underscores (_)"),
                   crayon_body(" in the name of the gene sets provided. Replacing them with "),
                   crayon_key("dots (.)"),
                   crayon_body(" to avoid conflicts when generating the Seurat assay.")), call. = FALSE)
    names.use <- stringr::str_replace_all(names(input_gene_list), "_", ".")
    names(input_gene_list) <- names.use
  }

  # Step 2: make the lists of equal length.
  max_value <- max(unname(unlist(lapply(input_gene_list, length))))
  min_value <- min(unname(unlist(lapply(input_gene_list, length))))

  assertthat::assert_that(length(input_gene_list) >= 2,
                          msg = paste0(add_cross(),
                                       crayon_body("Please make sure that the gene list you provide to "),
                                       crayon_key("input_gene_list"),
                                       crayon_body(" have at least "),
                                       crayon_key("two different"),
                                       crayon_body(" gene sets.")))

  assertthat::assert_that(min_value >= 5,
                          msg = paste0(add_cross(),
                                       crayon_body("Please make sure that the gene list you provide to "),
                                       crayon_key("input_gene_list"),
                                       crayon_body(" have at least "),
                                       crayon_key("five genes"),
                                       crayon_body(" each.")))
  
  
  if (base::isTRUE(values.show)){
    assertthat::assert_that(is.numeric(values.threshold),
                            msg = paste0(add_cross(), crayon_body("Please provide a value to "),
                                         crayon_key("values.threshold"),
                                         crayon_body(" when setting "),
                                         crayon_key("values.show = TRUE"),
                                         crayon_body(".")))
  }
  
  # Add fake genes until all lists have the same length so that it can be converted into a tibble.
  gene_list <- lapply(input_gene_list, function(x){
    if (length(x) != max_value){
      remaining <- max_value - length(x)
      x <- append(x, rep("deleteme", remaining))
      x
    } else{
      x
    }
  })

  # Generate the network as a tibble and filter out fake genes.
  network <- gene_list %>%
             tibble::as_tibble() %>%
             tidyr::pivot_longer(cols = dplyr::everything(),
                                 names_to = "source",
                                 values_to = "target") %>%
             dplyr::mutate("mor" = 1) %>%
             dplyr::filter(.data$target != "deleteme")

  # Get expression data.
  # Conditional behaviour for Seurat versions.
  if (utils::packageVersion("Seurat") < "5.0.0"){
    mat <- SeuratObject::GetAssayData(object = sample,
                                      assay = assay,
                                      slot = slot)
  } else {
    mat <- SeuratObject::GetAssayData(object = sample,
                                      assay = assay,
                                      layer = slot)
  }

  # Compute activities.
  if(isTRUE(verbose)){message(paste0(add_info(), crayon_body("Computing "),
                                     crayon_key("activities"),
                                     crayon_body("...")))}
  
  if (statistic == "ulm"){
    acts <- decoupleR::run_ulm(mat = mat, 
                               network = network)
  } else {
    acts <- decoupleR::run_wmean(mat = mat,
                                 network = network)
  }
  

  # Turn them into a matrix compatible to turn into a Seurat assay.
  acts.matrix <- acts %>%
                 dplyr::filter(.data$statistic == .env$statistic) %>%
                 tidyr::pivot_wider(id_cols = dplyr::all_of("source"),
                                    names_from = "condition",
                                    values_from = "score") %>%
                 tibble::column_to_rownames('source')

  # Generate a Seurat assay.
  assay.add <- Seurat::CreateAssayObject(acts.matrix)

  # Add the assay to the Seurat object.
  sample@assays$affinity <- assay.add
  sample@assays$affinity@key <- "affinity_"

  # Set it as default assay.
  Seurat::DefaultAssay(sample) <- "affinity"

  # Scale and center the activity data.
  sample <- Seurat::ScaleData(sample, verbose = FALSE, assay = "affinity")

  # Plotting.
  # Get the data frames per group.by value for plotting.
  list.data <- list()
  counter <- 0
  for (group in group.by){
    counter <- counter + 1
    
    if (utils::packageVersion("Seurat") < "5.0.0"){
      data.use <- SeuratObject::GetAssayData(object = sample,
                                             assay = "affinity",
                                             slot = "scale.data")
    } else {
      data.use <- SeuratObject::GetAssayData(object = sample,
                                             assay = "affinity",
                                             layer = "scale.data")
    }
    
    data.use <- data.use %>%
                t() %>%
                as.data.frame() %>%
                tibble::rownames_to_column(var = "cell") %>%
                dplyr::left_join(y = {sample@meta.data %>%
                                      tibble::rownames_to_column(var = "cell") %>%
                                      dplyr::select(dplyr::all_of(c("cell", group)))},
                                 by = "cell") %>%
                tidyr::pivot_longer(cols = -dplyr::all_of(c("cell", group)),
                                    names_to = "source",
                                    values_to = "score")
    # Clustering based on the median across all cells.
    data.cluster <- data.use %>%
                    tidyr::pivot_wider(id_cols = dplyr::all_of(c("cell", group)),
                                       names_from = "source",
                                       values_from = "score") %>%
                    dplyr::group_by(.data[[group]]) %>%
                    dplyr::summarise(dplyr::across(.cols = dplyr::all_of(c(names(input_gene_list))),
                                                   function(x){stats::median(x, na.rm = TRUE)})) %>%
                    as.data.frame() %>%
                    tibble::column_to_rownames(var = group)

    list.data[[group]][["data"]] <- data.use
    list.data[[group]][["data.cluster"]] <- data.cluster
  }

  # Plot individual heatmaps.

  list.heatmaps <- list()
  counter <- 0
  row.order.list <- list()
  for (group in group.by){
    counter <- counter + 1

    data.use <- list.data[[group]][["data"]]
    data.cluster <- list.data[[group]][["data.cluster"]]

    # nocov start
    if (counter == 1){
      if (length(colnames(data.cluster)) == 1){
        col_order <- colnames(data.cluster)[1]
      } else {
        col_order <- colnames(data.cluster)[stats::hclust(stats::dist(t(data.cluster), method = "euclidean"), method = "ward.D")$order]
      }
    }
    # nocov end

    if(length(rownames(data.cluster)) == 1){
      row_order <- rownames(data.cluster)[1]
    } else {
      row_order <- rownames(data.cluster)[stats::hclust(stats::dist(data.cluster, method = "euclidean"), method = "ward.D")$order]
    }
    row.order.list[[group]] <- row_order

    data.use <- data.use %>%
                dplyr::group_by(.data[[group]], .data$source) %>%
                dplyr::summarise("mean" = mean(.data$score, na.rm = TRUE))

    list.data[[group]][["data.mean"]] <- data.use

    if (!is.na(min.cutoff)){
      data.use <- data.use %>%
                  dplyr::mutate("mean" = ifelse(.data$mean < min.cutoff, min.cutoff, .data$mean))
    }

    if (!is.na(max.cutoff)){
      data.use <- data.use %>%
                  dplyr::mutate("mean" = ifelse(.data$mean > max.cutoff, max.cutoff, .data$mean))
    }
    p <- data.use %>%
         dplyr::mutate("source" = factor(.data$source, levels = col_order),
                       "target" = factor(.data[[group]], levels = row_order)) %>%
         # nocov start
         ggplot2::ggplot(mapping = ggplot2::aes(x = if (isTRUE(flip)){.data$source} else {.data$target},
                                                y = if (isTRUE(flip)){.data$target} else {.data$source},
                                                fill = .data$mean)) +
         # nocov end
         ggplot2::geom_tile(color = grid.color, linewidth = 0.5, na.rm = TRUE)
    
    if (base::isTRUE(values.show)){
      if (base::isTRUE(enforce_symmetry)){
        p <- p + 
          ggplot2::geom_text(ggplot2::aes(label = round(.data$mean, values.round), 
                                          color = ifelse(abs(.data$mean) > values.threshold, "white", "black")), 
                             size = values.size)
      } else {
        p <- p + 
          ggplot2::geom_text(ggplot2::aes(label = round(.data$mean, values.round), 
                                          color = ifelse(.data$mean > values.threshold, "white", "black")), 
                             size = values.size)
      }
      p <- p + ggplot2::scale_color_identity()
    }
    
    p <- p + 
         ggplot2::scale_y_discrete(expand = c(0, 0)) +
         ggplot2::scale_x_discrete(expand = c(0, 0),
                                   position = "top") +
         # nocov start
         ggplot2::guides(y.sec = guide_axis_label_trans(~paste0(levels(if (isTRUE(flip)){.data$target} else {.data$source}))),
                         x.sec = guide_axis_label_trans(~paste0(levels(if (isTRUE(flip)){.data$source} else {.data$target})))) +
         # nocov end
         ggplot2::coord_equal()
    list.heatmaps[[group]] <- p
  }


  # Compute limits.
  min.vector <- NULL
  max.vector <- NULL

  for (group in group.by){
    data.limits <-  list.data[[group]][["data.mean"]]

    min.vector <- append(min.vector, min(data.limits$mean, na.rm = TRUE))
    max.vector <- append(max.vector, max(data.limits$mean, na.rm = TRUE))
  }

  # Get the absolute limits of the datasets.
  limits <- c(min(min.vector, na.rm = TRUE),
              max(max.vector, na.rm = TRUE))

  # Compute overarching scales for all heatmaps.
  scale.setup <- compute_scales(sample = sample,
                                feature = " ",
                                assay = assay,
                                reduction = NULL,
                                slot = slot,
                                number.breaks = number.breaks,
                                min.cutoff = min.cutoff,
                                max.cutoff = max.cutoff,
                                flavor = "Seurat",
                                enforce_symmetry = enforce_symmetry,
                                from_data = TRUE,
                                limits.use = limits)

  for (group in group.by){
    p <- list.heatmaps[[group]]

    p <- p +
         ggplot2::scale_fill_gradientn(colors = colors.gradient,
                                       na.value = na.value,
                                       name = paste0("Z-scored | ", statistic, " score"),
                                       breaks = scale.setup$breaks,
                                       labels = scale.setup$labels,
                                       limits = scale.setup$limits)

    list.heatmaps[[group]] <- p
  }

  # Modify legends.
  for (group in group.by){
    p <- list.heatmaps[[group]]

    p <- modify_continuous_legend(p = p,
                                  legend.aes = "fill",
                                  legend.type = legend.type,
                                  legend.position = legend.position,
                                  legend.length = legend.length,
                                  legend.width = legend.width,
                                  legend.framecolor = legend.framecolor,
                                  legend.tickcolor = legend.tickcolor,
                                  legend.framewidth = legend.framewidth,
                                  legend.tickwidth = legend.tickwidth)
    list.heatmaps[[group]] <- p
  }

  # Add theme
  counter <- 0
  for (group in group.by){
    counter <- counter + 1

    p <- list.heatmaps[[group]]

    # Set axis titles.
    if (isTRUE(flip)){
      if (counter == 1){
        ylab <- group
        xlab <- NULL
        if (length(group.by) == counter){
          xlab <- "Gene set"
        }
      } else {
        xlab <- "Gene set"
        ylab <- group
      }
    } else {
      if (counter == 1){
        ylab <- "Gene set"
        xlab <- group
      } else {
        ylab <- NULL
        xlab <- group
      }
    }


    p <- list.heatmaps[[group]]

    axis.parameters <- handle_axis(flip = !flip,
                                   group.by = rep("A", length(group.by)),
                                   group = group,
                                   counter = counter,
                                   axis.text.x.angle = axis.text.x.angle,
                                   plot.title.face = plot.title.face,
                                   plot.subtitle.face = plot.subtitle.face,
                                   plot.caption.face = plot.caption.face,
                                   axis.title.face = axis.title.face,
                                   axis.text.face = axis.text.face,
                                   legend.title.face = legend.title.face,
                                   legend.text.face = legend.text.face)

    p <- p +
         ggplot2::xlab(xlab) +
         ggplot2::ylab(ylab) +
         ggplot2::theme_minimal(base_size = font.size) +
         ggplot2::theme(axis.ticks.x.bottom = axis.parameters$axis.ticks.x.bottom,
                        axis.ticks.x.top = axis.parameters$axis.ticks.x.top,
                        axis.ticks.y.left = axis.parameters$axis.ticks.y.left,
                        axis.ticks.y.right = axis.parameters$axis.ticks.y.right,
                        axis.text.y.left = axis.parameters$axis.text.y.left,
                        axis.text.y.right = axis.parameters$axis.text.y.right,
                        axis.text.x.top = axis.parameters$axis.text.x.top,
                        axis.text.x.bottom = axis.parameters$axis.text.x.bottom,
                        axis.title.x.bottom = axis.parameters$axis.title.x.bottom,
                        axis.title.x.top = axis.parameters$axis.title.x.top,
                        axis.title.y.right = axis.parameters$axis.title.y.right,
                        axis.title.y.left = axis.parameters$axis.title.y.left,
                        strip.background = axis.parameters$strip.background,
                        strip.clip = axis.parameters$strip.clip,
                        strip.text = axis.parameters$strip.text,
                        legend.position = legend.position,
                        axis.line = ggplot2::element_blank(),
                        plot.title = ggplot2::element_text(face = plot.title.face, hjust = 0),
                        plot.subtitle = ggplot2::element_text(face = plot.subtitle.face, hjust = 0),
                        plot.caption = ggplot2::element_text(face = plot.caption.face, hjust = 1),
                        plot.title.position = "plot",
                        panel.grid = ggplot2::element_blank(),
                        panel.grid.minor.y = ggplot2::element_line(color = "white", linewidth = 1),
                        text = ggplot2::element_text(family = font.type),
                        plot.caption.position = "plot",
                        legend.text = ggplot2::element_text(face = legend.text.face),
                        legend.title = ggplot2::element_text(face = legend.title.face),
                        legend.justification = "center",
                        plot.margin = ggplot2::margin(t = 0, r = 0, b = 0, l = 0),
                        panel.border = ggplot2::element_rect(fill = NA, color = border.color, linewidth = 1),
                        panel.grid.major = ggplot2::element_blank(),
                        plot.background = ggplot2::element_rect(fill = "white", color = "white"),
                        panel.background = ggplot2::element_rect(fill = "white", color = "white"),
                        legend.background = ggplot2::element_rect(fill = "white", color = "white"),
                        panel.spacing.x = ggplot2::unit(0, "cm"))

    list.heatmaps[[group]] <- p
  }


  if (isTRUE(flip)){
    list.heatmaps <- list.heatmaps[rev(group.by)]
  }
  p <- patchwork::wrap_plots(list.heatmaps,
                             ncol = if (base::isFALSE(flip)){NULL} else {1},
                             nrow = if(base::isFALSE(flip)){1} else {NULL},
                             guides = "collect")
  p <- p +
       patchwork::plot_annotation(theme = ggplot2::theme(legend.position = legend.position,
                                                         plot.title = ggplot2::element_text(family = font.type,
                                                                                            color = "black",
                                                                                            face = "bold",
                                                                                            hjust = 0),
                                                         plot.subtitle = ggplot2::element_text(family = font.type,
                                                                                               color = "black",
                                                                                               hjust = 0),
                                                         plot.caption = ggplot2::element_text(family = font.type,
                                                                                              color = "black",
                                                                                              hjust = 1),
                                                         plot.caption.position = "plot"))

  list.output <- list()

  list.output[["Heatmap"]] <- p


  if (isTRUE(return_object)){
    list.output[["Object"]] <- sample
  }

  if (isTRUE(return_object)){
    return_me <- list.output
  } else {
    return_me <- list.output$Heatmap
  }

  return(return_me)
}


================================================
FILE: R/do_AlluvialPlot.R
================================================
#' Generate Alluvial plots.
#'
#' This function is based on the \pkg{ggalluvial} package. It allows you to generate alluvial plots from a given Seurat object.
#'
#' @inheritParams doc_function
#'
#' @param first_group \strong{\code{\link[base]{character}}} | Categorical metadata variable. First group of nodes of the alluvial plot.
#' @param last_group \strong{\code{\link[base]{character}}} | Categorical metadata variable. Last group of nodes of the alluvial plot.
#' @param middle_groups \strong{\code{\link[base]{character}}} | Categorical metadata variable. Vector of groups of nodes of the alluvial plot.
#' @param colors.use \strong{\code{\link[base]{character}}} | Named list of colors corresponding to the unique values in fill.by (which defaults to last_group).
#' @param fill.by \strong{\code{\link[base]{character}}} | One of first_group, middle_groups (one of the values, if multiple mid_groups) or last_group. These values will be used to color the alluvium/flow.
#' @param use_labels \strong{\code{\link[base]{logical}}} | Whether to use labels instead of text for the stratum.
#' @param stratum.color,alluvium.color,flow.color \strong{\code{\link[base]{character}}} | Color for the border of the alluvium (and flow) and stratum.
#' @param stratum.fill \strong{\code{\link[base]{character}}} | Color to fill the stratum.
#' @param stratum.width \strong{\code{\link[base]{logical}}} | Width of the stratum.
#' @param stratum.fill.conditional \strong{\code{\link[base]{logical}}} | Whether to fill the stratum with the same colors as the alluvium/flow.
#' @param use_geom_flow \strong{\code{\link[base]{logical}}} | Whether to use \code{\link[ggalluvial]{geom_flow}} instead of \code{\link[ggalluvial]{geom_alluvium}}. Visual results might differ.
#' @param label.color \strong{\code{\link[base]{character}}} | Color for the text labels.
#' @param curve_type \strong{\code{\link[base]{character}}} | Type of curve used in \code{\link[ggalluvial]{geom_alluvium}}. One of:
#' \itemize{
#'   \item \emph{\code{linear}}.
#'   \item \emph{\code{cubic}}.
#'   \item \emph{\code{quintic}}.
#'   \item \emph{\code{sine}}.
#'   \item \emph{\code{arctangent}}.
#'   \item \emph{\code{sigmoid}}.
#'   \item \emph{\code{xspline}}.
#' }
#'
#' @return A ggplot2 object.
#' @export
#'
#' @example /man/examples/examples_do_AlluvialPlot.R
do_AlluvialPlot <- function(sample,
                            first_group,
                            last_group,
                            middle_groups = NULL,
                            colors.use = NULL,
                            colorblind = FALSE,
                            plot.title = NULL,
                            plot.subtitle = NULL,
                            plot.caption = NULL,
                            font.size = 14,
                            font.type = "sans",
                            xlab = NULL,
                            ylab = "Number of cells",
                            repel = FALSE,
                            fill.by = last_group,
                            use_labels = FALSE,
                            stratum.color = "black",
                            stratum.fill = "white",
                            stratum.width = 1/3,
                            stratum.fill.conditional = FALSE,
                            use_geom_flow = FALSE,
                            alluvium.color = "white",
                            flow.color = "white",
                            flip = FALSE,
                            label.color = "black",
                            curve_type = "sigmoid",
                            use_viridis = FALSE,
                            viridis.palette = "G",
                            viridis.direction = -1,
                            sequential.palette = "YlGnBu",
                            sequential.direction = 1,
                            plot.grid = FALSE,
                            grid.color = "grey75",
                            grid.type = "dashed",
                            na.value = "white",
                            legend.position = "bottom",
                            legend.title = NULL,
                            plot.title.face = "bold",
                            plot.subtitle.face = "plain",
                            plot.caption.face = "italic",
                            axis.title.face = "bold",
                            axis.text.face = "plain",
                            legend.title.face = "bold",
                            legend.text.face = "plain"){
  # Add lengthy error messages.
  withr::local_options(.new = list("warning.length" = 8170))
  
  check_suggests(function_name = "do_AlluvialPlot")
  check_Seurat(sample)
  
  
  

  # Check logical parameters.
  logical_list <- list("use_labels" = use_labels,
                       "stratum.fill.conditional" = stratum.fill.conditional,
                       "flip" = flip,
                       "plot.grid" = plot.grid,
                       "repel" = repel,
                       "use_geom_flow" = use_geom_flow,
                       "use_viridis" = use_viridis,
                       "colorblind" = colorblind)
  check_type(parameters = logical_list, required_type = "logical", test_function = is.logical)
  # Check numeric parameters.
  numeric_list <- list("stratum.width" = stratum.width,
                       "font.size" = font.size,
                       "viridis.direction" = viridis.direction,
                       "sequential.direction" = sequential.direction)
  check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric)
  # Check character parameters.
  character_list <- list("first_group" = first_group,
                         "last_group" = last_group,
                         "middle_groups" = middle_groups,
                         "colors.use" = colors.use,
                         "plot.title" = plot.title,
                         "plot.subtitle" = plot.subtitle,
                         "plot.caption" = plot.caption,
                         "font.type" = font.type,
                         "xlab" = xlab,
                         "ylab" = ylab,
                         "fill.by" = fill.by,
                         "stratum.color" = stratum.color,
                         "stratum.fill" = stratum.fill,
                         "alluvium.color" = alluvium.color,
                         "flow.color" = flow.color,
                         "label.color" = label.color,
                         "curve_type" = curve_type,
                         "viridis.palette" = viridis.palette,
                         "grid.color" = grid.color,
                         "grid.type" = grid.type,
                         "na.value" = na.value,
                         "legend.position" = legend.position,
                         "legend.title" = legend.title,
                         "plot.title.face" = plot.title.face,
                         "plot.subtitle.face" = plot.subtitle.face,
                         "plot.caption.face" = plot.caption.face,
                         "axis.title.face" = axis.title.face,
                         "axis.text.face" = axis.text.face,
                         "legend.title.face" = legend.title.face,
                         "legend.text.face" = legend.text.face,
                         "sequential.palette" = sequential.palette)
  check_type(parameters = character_list, required_type = "character", test_function = is.character)

  check_parameters(parameter = font.type, parameter_name = "font.type")
  check_parameters(parameter = legend.position, parameter_name = "legend.position")
  check_parameters(plot.title.face, parameter_name = "plot.title.face")
  check_parameters(plot.subtitle.face, parameter_name = "plot.subtitle.face")
  check_parameters(plot.caption.face, parameter_name = "plot.caption.face")
  check_parameters(axis.title.face, parameter_name = "axis.title.face")
  check_parameters(axis.text.face, parameter_name = "axis.text.face")
  check_parameters(legend.title.face, parameter_name = "legend.title.face")
  check_parameters(legend.text.face, parameter_name = "legend.text.face")
  check_parameters(viridis.direction, parameter_name = "viridis.direction")
  check_parameters(sequential.direction, parameter_name = "sequential.direction")
  
  # Check minimum version.
  assertthat::assert_that(utils::packageVersion("ggalluvial") >= "0.12.5",
                          msg = paste0(add_cross(), crayon_body("Please, update "),
                                       crayon_key("ggalluvial"),
                                       crayon_body(" to minimum version "),
                                       crayon_key("0.12.5"),
                                       crayon_body(".")))
  

  #StatStratum <- ggalluvial::StatStratum
  `%>%` <- magrittr::`%>%`
  
  colors.gradient <- compute_continuous_palette(name = ifelse(isTRUE(use_viridis), viridis.palette, sequential.palette),
                                                use_viridis = use_viridis,
                                                direction = ifelse(isTRUE(use_viridis), viridis.direction, sequential.direction),
                                                enforce_symmetry = FALSE)
  
  if (isTRUE(use_labels)){
    if (isTRUE(repel)){
      func_use <- ggrepel::geom_label_repel
    } else if (base::isFALSE(repel)){
      func_use <- ggplot2::geom_label
    }
  } else if (base::isFALSE(use_labels)){
    if (isTRUE(repel)){
      func_use <- ggrepel::geom_text_repel
    } else if (base::isFALSE(repel)){
      func_use <- ggplot2::geom_text
    }
  }

  vars.use <- c(first_group)
  for (variable in middle_groups){
    vars.use <- append(vars.use, variable)
  }
  vars.use <- append(vars.use, last_group)

  for (var in vars.use){
    assertthat::assert_that(var %in% colnames(sample@meta.data),
                            msg = paste0(add_cross(), crayon_body("Please make sure that the variables provided to "),
                                         crayon_key("first_group"),
                                         crayon_body(", "),
                                         crayon_key("middle_groups"),
                                         crayon_body(" and "),
                                         crayon_key("last_group"),
                                         crayon_body(" are "),
                                         crayon_key("metadata variables"),
                                         crayon_body(".")))

    assertthat::assert_that(class(sample@meta.data[, var]) %in% c("character", "factor"),
                            msg = paste0(add_cross(), crayon_body("Please make sure that the variables provided to "),
                                         crayon_key("first_group"),
                                         crayon_body(", "),
                                         crayon_key("middle_groups"),
                                         crayon_body(" and "),
                                         crayon_key("last_group"),
                                         crayon_body(" are of class "),
                                         crayon_key("character"),
                                         crayon_body(" or "),
                                         crayon_key("factor"),
                                         crayon_body(".")))
  }

  assertthat::assert_that(length(fill.by) == 1,
                          msg = paste0(add_cross(), crayon_body("Please provide a single value to "),
                                       crayon_key("fill.by"),
                                       crayon_body(".")))


  assertthat::assert_that(isTRUE(fill.by %in% vars.use),
                          msg = paste0(add_cross(), crayon_body("Paramter "),
                                       crayon_key("fill.by"),
                                       crayon_body(" has to be the same as one of the values in "),
                                       crayon_key("first_group"),
                                       crayon_body(", "),
                                       crayon_key("middle_groups"),
                                       crayon_body(" and "),
                                       crayon_key("last_group"),
                                       crayon_body(".")))
  suppressMessages({
    data <- sample@meta.data %>%
            dplyr::select(dplyr::all_of(vars.use)) %>%
            dplyr::group_by_at(vars.use) %>%
            dplyr::summarise(n = dplyr::n())
  })


  # COLORS.
  if (is.null(colors.use)){
    if (is.factor(data[[fill.by]])){
      colors.use <- generate_color_scale(levels(data[[fill.by]]), colorblind = colorblind)
    } else {
      colors.use <- generate_color_scale(sort(unique(data[[fill.by]])), colorblind = colorblind)
    }
  } else {
    check_colors(colors.use)
  }
  
  if (is.null(legend.title)){
    legend.title = last_group
  }

  p <- prepare_ggplot_alluvial_plot(data = data,
                                    vars.use = vars.use)

  if (isTRUE(use_geom_flow)){
    p <- p +
         ggalluvial::geom_flow(mapping = ggplot2::aes(fill = .data[[fill.by]]),
                               color = flow.color)
  } else if (base::isFALSE(use_geom_flow)){
    p <- p +
         ggalluvial::geom_alluvium(mapping = ggplot2::aes(fill = .data[[fill.by]]),
                                                          color = alluvium.color,
                                                          curve_type = curve_type)
  }
  if (isTRUE(stratum.fill.conditional)){
    p <- p +
         ggalluvial::geom_stratum(color = stratum.color,
                                  mapping = ggplot2::aes(fill = .data[[fill.by]]),
                                  width = stratum.width)
  } else if (base::isFALSE(stratum.fill.conditional)){
    p <- p +
         ggalluvial::geom_stratum(color = stratum.color,
                                  fill = stratum.fill,
                                  width = stratum.width)
  }
  p <- p  +
    func_use(stat = ggalluvial::StatStratum,
             mapping = ggplot2::aes(label = ggplot2::after_stat(stratum)),
             color = label.color,
             fontface = "bold") +
    ggplot2::scale_x_discrete(limits = vars.use)

  if (is.null(colors.use)){
    p <- p + 
         ggplot2::scale_fill_gradientn(colors = colors.gradient,
                                       na.value = na.value,
                                       name = legend.title)
  } else if (base::isFALSE(use_viridis)){
    p <- p +
         ggplot2::scale_fill_manual(values = colors.use,
                                    na.value = na.value,
                                    name = legend.title)
  }
  p <- p +
       ggplot2::xlab(xlab) +
       ggplot2::ylab(ylab) +
       ggplot2::labs(title = plot.title,
                     subtitle = plot.subtitle,
                     caption = plot.caption) +
       ggplot2::theme_minimal(base_size = font.size) +
       ggplot2::theme(axis.title = ggplot2::element_text(color = "black",
                                                         face = axis.title.face),
                      axis.line.x = if (base::isFALSE(flip)){ggplot2::element_blank()} else {ggplot2::element_line(color = "black")},
                      axis.line.y = if (base::isFALSE(flip)){ggplot2::element_line(color = "black")} else {ggplot2::element_blank()},
                      axis.ticks.y = if (base::isFALSE(flip)){ggplot2::element_line(color = "black")} else {ggplot2::element_blank()},
                      axis.ticks.x = if (base::isFALSE(flip)){ggplot2::element_blank()} else {ggplot2::element_line(color = "black")},
                      axis.text.y = ggplot2::element_text(color = "black", face = axis.text.face),
                      axis.text.x = ggplot2::element_text(color = "black", face = axis.text.face),
                      panel.grid.major = ggplot2::element_blank(),
                      plot.title.position = "plot",
                      plot.title = ggplot2::element_text(face = plot.title.face, hjust = 0),
                      plot.subtitle = ggplot2::element_text(face = plot.subtitle.face, hjust = 0),
                      plot.caption = ggplot2::element_text(face = plot.caption.face, hjust = 1),
                      panel.grid = ggplot2::element_blank(),
                      panel.grid.major.y = if (base::isFALSE(flip)) {if (isTRUE(plot.grid)){ggplot2::element_line(color = grid.color, linetype = grid.type)}} else if (isTRUE(flip)) {ggplot2::element_blank()},
                      panel.grid.major.x = if (isTRUE(flip)) {if (isTRUE(plot.grid)){ggplot2::element_line(color = grid.color, linetype = grid.type)}} else if (base::isFALSE(flip)) {ggplot2::element_blank()},
                      text = ggplot2::element_text(family = font.type),
                      plot.caption.position = "plot",
                      legend.text = ggplot2::element_text(face = legend.text.face),
                      legend.position = legend.position,
                      legend.title = ggplot2::element_text(face = legend.title.face),
                      legend.justification = "center",
                      plot.margin = ggplot2::margin(t = 10, r = 10, b = 10, l = 10),
                      plot.background = ggplot2::element_rect(fill = "white", color = "white"),
                      panel.background = ggplot2::element_rect(fill = "white", color = "white"),
                      legend.background = ggplot2::element_rect(fill = "white", color = "white"),
                      strip.text =ggplot2::element_text(color = "black", face = "bold"))
  
  p <- p +
       ggplot2::guides(fill = ggplot2::guide_legend(title = legend.title,
                                                    title.position = "top",
                                                    title.hjust = 0.5,
                                                    override.aes = list(color = "black",
                                                                        shape = 22))) 
  

  if (isTRUE(flip)){
    p <- p + ggplot2::coord_flip()
  }
  return(p)
}


================================================
FILE: R/do_BarPlot.R
================================================

#' Create Bar Plots.
#'
#' @inheritParams doc_function
#' @param group.by \strong{\code{\link[base]{character}}} | Metadata column to compute the counts of. Has to be either a character or factor column.
#' @param split.by \strong{\code{\link[base]{character}}} | Metadata column to split the values of group.by by. If not used, defaults to the active idents.
#' @param facet.by \strong{\code{\link[base]{character}}} | Metadata column to gather the columns by. This is useful if you have other overarching metadata.
#' @param order \strong{\code{\link[base]{logical}}} | Whether to order the results in descending order of counts.
#' @param order.by \strong{\code{\link[base]{character}}} | When \strong{\code{split.by}} is used, value of \strong{\code{group.by}} to reorder the columns based on its value.
#' @param position \strong{\code{\link[base]{character}}} | Position function from \pkg{ggplot2}. Either stack or fill.
#' @param return_data \strong{\code{\link[base]{logical}}} | Returns a data.frame with the count and proportions displayed in the plot.
#' @param add.n \strong{\code{\link[base]{logical}}} | Whether to add the total counts on top of each bar.
#' @param add.n.face \strong{\code{\link[base]{character}}} | Font face of the labels added by \strong{\code{add.n}}.
#' @param add.n.size \strong{\code{\link[base]{numeric}}} | Size of the labels
#' @param add.n.expand \strong{\code{\link[base]{numeric}}} | Vector of two numerics representing the start and end of the scale. Minimum should be 0 and max should be above 1. This basically expands the Y axis so that the labels fit when \strong{\code{flip = TRUE}}.
#' \itemize{
#'   \item \emph{\code{stack}}: Set the bars side by side, displaying the total number of counts. Uses \link[ggplot2]{position_stack}.
#'   \item \emph{\code{fill}}: Set the bars on top of each other, displaying the proportion of counts from the total that each group represents. Uses \link[ggplot2]{position_fill}.
#' }
#' @return A ggplot2 object containing a Bar plot.
#' @export
#'
#' @example /man/examples/examples_do_BarPlot.R
do_BarPlot <- function(sample,
                       group.by,
                       order = FALSE,
                       add.n = FALSE,
                       add.n.face = "bold",
                       add.n.expand = c(0, 1.15),
                       add.n.size = 4,
                       order.by = NULL,
                       split.by = NULL,
                       facet.by = NULL,
                       position = "stack",
                       font.size = 14,
                       font.type = "sans",
                       legend.position = "bottom",
                       legend.title = NULL,
                       legend.ncol = NULL,
                       legend.nrow = NULL,
                       legend.byrow = FALSE,
                       axis.text.x.angle = 45,
                       xlab = NULL,
                       ylab = NULL,
                       colors.use = NULL,
                       colorblind = FALSE,
                       flip = FALSE,
                       plot.title = NULL,
                       plot.subtitle = NULL,
                       plot.caption = NULL,
                       plot.grid = FALSE,
                       grid.color = "grey75",
                       grid.type = "dashed",
                       plot.title.face = "bold",
                       plot.subtitle.face = "plain",
                       plot.caption.face = "italic",
                       axis.title.face = "bold",
                       axis.text.face = "plain",
                       legend.title.face = "bold",
                       legend.text.face = "plain",
                       strip.text.face = "bold",
                       return_data = FALSE) {
  # Add lengthy error messages.
  withr::local_options(.new = list("warning.length" = 8170))
  
  check_suggests(function_name = "do_BarPlot")
  check_Seurat(sample)

  `%>%` <- magrittr::`%>%`
  `:=` <- rlang::`:=`

  # Check logical parameters.
  logical_list <- list("order" = order,
                       "flip" = flip,
                       "plot.grid" = plot.grid,
                       "legend.byrow" = legend.byrow,
                       "add.n" = add.n,
                       "return_data" = return_data,
                       "colorblind" = colorblind)
  check_type(parameters = logical_list, required_type = "logical", test_function = is.logical)
  # Check numeric parameters.
  numeric_list <- list("font.size" = font.size,
                       "axis.text.x.angle" = axis.text.x.angle,
                       "legend.ncol" = legend.ncol,
                       "legend.nrow" = legend.nrow,
                       "add.n.expand" = add.n.expand)
  check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric)
  # Check character parameters.

  character_list <- list("group.by" = group.by,
                         "split.by" = split.by,
                         "facet.by" = facet.by,
                         "order.by" = order.by,
                         "position" = position,
                         "font.type" = font.type,
                         "legend.position" = legend.position,
                         "legend.title" = legend.title,
                         "xlab" = xlab,
                         "ylab" = ylab,
                         "plot.title" = plot.title,
                         "plot.subtitle" = plot.subtitle,
                         "plot.caption" = plot.caption,
                         "grid.color" = grid.color,
                         "grid.type" = grid.type,
                         "legend.title" = legend.title,
                         "plot.title.face" = plot.title.face,
                         "plot.subtitle.face" = plot.subtitle.face,
                         "plot.caption.face" = plot.caption.face,
                         "axis.title.face" = axis.title.face,
                         "axis.text.face" = axis.text.face,
                         "legend.title.face" = legend.title.face,
                         "legend.text.face" = legend.text.face)
  # Checks
  check_type(parameters = character_list, required_type = "character", test_function = is.character)

  check_colors(grid.color, parameter_name = "grid.color")

  check_parameters(parameter = font.type, parameter_name = "font.type")
  check_parameters(parameter = legend.position, parameter_name = "legend.position")
  check_parameters(parameter = grid.type, parameter_name = "grid.type")
  check_parameters(parameter = axis.text.x.angle, parameter_name = "axis.text.x.angle")
  check_parameters(plot.title.face, parameter_name = "plot.title.face")
  check_parameters(plot.subtitle.face, parameter_name = "plot.subtitle.face")
  check_parameters(plot.caption.face, parameter_name = "plot.caption.face")
  check_parameters(axis.title.face, parameter_name = "axis.title.face")
  check_parameters(axis.text.face, parameter_name = "axis.text.face")
  check_parameters(legend.title.face, parameter_name = "legend.title.face")
  check_parameters(legend.text.face, parameter_name = "legend.text.face")
  check_parameters(strip.text.face, parameter_name = "strip.text.face")
  # Get the general table.
  assertthat::assert_that(class(sample@meta.data[, group.by]) %in% c("character", "factor"),
                          msg = paste0(add_cross(), crayon_body("Please provide to "),
                                       crayon_key("feature"),
                                       crayon_body(" a "),
                                       crayon_key(" metadta categorical "),
                                       crayon_body(" variable.")))
  
  assertthat::assert_that(base::isFALSE(position == "fill" & is.null(split.by)),
                          msg = paste0(add_cross(),
                                       crayon_body("Please use "),
                                       crayon_key("position =  fill"),
                                       crayon_body(" alongisde "),
                                       crayon_key("split.by"),
                                       crayon_body(".")))
  
  assertthat::assert_that(base::isFALSE(position == "stack" & isTRUE(order) & !is.null(order.by)),
                          msg = paste0(add_cross(),
                                       crayon_body("Please use "),
                                       crayon_key("order.by"),
                                       crayon_body(" alongisde "),
                                       crayon_key("position = fill"),
                                       crayon_body(".")))
  
  assertthat::assert_that(base::isFALSE(position == "fill" & isTRUE(order) & is.null(order.by)),
                          msg = paste0(add_cross(),
                                       crayon_body("Please use "),
                                       crayon_key("order.by"),
                                       crayon_body(" alongisde "),
                                       crayon_key("position = fill"),
                                       crayon_body(".")))
  
  if (is.null(colors.use)){
    colors.use <- generate_color_scale(names_use = if (is.factor(sample@meta.data[, group.by])) {levels(sample@meta.data[, group.by])} else {sort(unique(sample@meta.data[, group.by]))}, colorblind = colorblind)
  } else {
    check_colors(colors.use, parameter_name = "colors.use")
    check_consistency_colors_and_names(sample = sample, colors = colors.use, grouping_variable = group.by)
    colors.use <- colors.use[unique(sample@meta.data[, group.by])]
  }
  
  # Check group.by.
  out <- check_group_by(sample = sample,
                        group.by = group.by,
                        is.heatmap = FALSE)
  sample <- out[["sample"]]
  group.by <- out[["group.by"]]
  
  data <-  sample@meta.data %>%
           tibble::as_tibble() %>%
           dplyr::select(dplyr::all_of(c(group.by, split.by, facet.by)))
  
  if (isTRUE(order)){
    if (is.null(order.by)){
      order.use <- sample@meta.data %>%
                   tibble::as_tibble() %>%
                   dplyr::select(dplyr::all_of(c(group.by, split.by))) %>%
                   dplyr::group_by(.data[[group.by]]) %>%
                   dplyr::summarise("n" = dplyr::n()) %>%
                   dplyr::arrange(if(base::isFALSE(flip)){dplyr::desc(.data[["n"]])} else {.data[["n"]]}) %>%
                   dplyr::pull(.data[[group.by]]) %>%
                   as.character()
      data <- data %>% 
              dplyr::mutate("{group.by}" := factor(as.character(.data[[group.by]]), 
                                                   levels = order.use))
    } else {
      order.use <- sample@meta.data %>%
                   tibble::as_tibble() %>%
                   dplyr::mutate(dplyr::across(dplyr::all_of(c(group.by, split.by)), as.character),
                                 "count" = 1) %>% 
                   tidyr::complete(.data[[split.by]], .data[[group.by]], explicit = FALSE) %>% 
                   dplyr::group_by(.data[[split.by]], .data[[group.by]]) %>%
                   dplyr::summarise("n" = sum(.data$count, na.rm = TRUE),
                                    "{split.by}" := unique(.data[[split.by]])) %>% 
                   dplyr::reframe("freq" = .data$n / sum(.data$n),
                                  "{split.by}" := unique(.data[[split.by]]),
                                  "{group.by}" := unique(.data[[group.by]])) %>% 
                   dplyr::filter(.data[[group.by]] == order.by) %>% 
                   dplyr::arrange(if(base::isFALSE(flip)){dplyr::desc(.data[["freq"]])} else {.data[["freq"]]}) %>% 
                   dplyr::pull(.data[[split.by]]) %>% 
                   as.character()
      
      data <- data %>% 
              dplyr::mutate("{split.by}" := factor(as.character(.data[[split.by]]), 
                                                   levels = order.use))
    }
  }
  
  if (isTRUE(add.n)){
    assertthat::assert_that(position == "fill",
                            msg = paste0(add_cross(),
                                         crayon_body("Parameter "),
                                         crayon_key("add.n"),
                                         crayon_body(" can only be used alongside "),
                                         crayon_key("position = fill"),
                                         crayon_body(".")))
    if (is.null(split.by) & !is.null(group.by)){
      # nocov start
      data.n <- data %>% 
                dplyr::group_by(.data[[group.by]]) %>% 
                dplyr::summarise(n = dplyr::n()) %>% 
                dplyr::mutate(n = paste0("n = ", .data$n))
      # nocov end
    } else if (!is.null(split.by) & !is.null(group.by)){
      data.n <- data %>% 
                dplyr::group_by(.data[[split.by]]) %>% 
                dplyr::summarise(n = dplyr::n()) %>% 
                dplyr::mutate(n = paste0("n = ", .data$n))
    }
    max.char <- max(vapply(data.n$n, nchar, FUN.VALUE = integer(1)))
    data.n$n <- vapply(data.n$n, function(x){return(paste0(x, paste(rep(" ", (max.char - nchar(x))), collapse = "")))}, FUN.VALUE = character(1))
  }
  
          
  if (is.null(split.by)){
    p <- data %>%
         ggplot2::ggplot(mapping = ggplot2::aes(x = .data[[group.by]],
                                                fill = .data[[group.by]]))
  } else {
    p <- data %>%
         ggplot2::ggplot(mapping = ggplot2::aes(x = .data[[split.by]],
                                                fill = .data[[group.by]]))
  }
  
  
  if (is.null(xlab)){
    if (!is.null(group.by) & is.null(split.by)){
      xlab <- group.by
    } else if (!is.null(group.by) & !is.null(split.by)){
      xlab <- split.by
    }
  }
  
  if (is.null(ylab)){
    ylab <- ifelse(position == "stack", "Count", "Proportion")
  }
  
 if (is.null(legend.title)){
   if (position == "stack"){
     if (is.null(split.by)){
       legend.title <- NULL
     } else {
       legend.title <- split.by
     }
   } else {
     legend.title <- group.by
   }
 }

  p <- p +
       ggplot2::stat_count(geom = "bar", position = position, color = "black")
  
  if (isTRUE(add.n)){
    if (is.null(split.by) & !is.null(group.by)){
      # nocov start
      p <- p + 
           ggplot2::geom_text(data = data.n,
                              mapping = ggplot2::aes(x = .data[[group.by]],
                                                     y = ifelse(base::isFALSE(flip), 1.03, 1.01),
                                                     label = .data$n,
                                                     fill = NULL),
                              hjust = ifelse(isTRUE(flip), 0, 0.5),
                              fontface = "plain",
                              size = add.n.size)
      # nocov end
    } else if (!is.null(split.by) & !is.null(group.by)){
      p <- p + 
           ggplot2::geom_text(data = data.n,
                              mapping = ggplot2::aes(x = .data[[split.by]],
                                                     y = ifelse(base::isFALSE(flip), 1.03, 1.01),
                                                     label = .data$n,
                                                     fill = NULL),
                              hjust = ifelse(isTRUE(flip), 0, 0.5),
                              fontface = "plain",
                              size = add.n.size)
    }
    p <- p + 
         ggplot2::scale_y_continuous(limits = add.n.expand, labels = c("0", "0.25", "0.5", "0.75", "1"), breaks = c(0, 0.25, 0.5, 0.75, 1))

  }
  
  if (isTRUE(flip)){
    p <- p + ggplot2::coord_flip()
  }
  
  if (!is.null(facet.by)){
    if (base::isFALSE(flip)){
      p <- p + 
        ggplot2::facet_grid(cols = ggplot2::vars(.data[[facet.by]]),
                            scales = "free",
                            space = "free",
                            drop = TRUE)
    } else {
      p <- p + 
        ggplot2::facet_grid(rows = ggplot2::vars(.data[[facet.by]]),
                            scales = "free",
                            space = "free",
                            drop = TRUE)
    }
  }
  p <- p +
       ggplot2::xlab(xlab) +
       ggplot2::ylab(ylab) +
       ggplot2::labs(title = plot.title,
                     subtitle = plot.subtitle,
                     caption = plot.caption) +
       ggplot2::scale_fill_manual(values = colors.use) +
       ggplot2::guides(fill = ggplot2::guide_legend(title = legend.title,
                                                    title.position = "top",
                                                    title.hjust = 0.5,
                                                    ncol = legend.ncol,
                                                    nrow = legend.nrow,
                                                    byrow = legend.byrow)) +
       ggplot2::theme_minimal(base_size = font.size) +
       ggplot2::theme(axis.title = ggplot2::element_text(color = "black",
                                                         face = axis.title.face),
                      panel.grid.major.y = if (base::isFALSE(flip)) {if (isTRUE(plot.grid)){ggplot2::element_line(color = grid.color, linetype = grid.type)}} else if (isTRUE(flip)) {ggplot2::element_blank()},
                      panel.grid.major.x = if (isTRUE(flip)) {if (isTRUE(plot.grid)){ggplot2::element_line(color = grid.color, linetype = grid.type)}} else if (base::isFALSE(flip)) {ggplot2::element_blank()},
                      axis.line.x = if (base::isFALSE(flip)) {ggplot2::element_line(color = "black")} else if (isTRUE(flip)) {ggplot2::element_blank()},
                      axis.line.y = if (isTRUE(flip)) {ggplot2::element_line(color = "black")} else if (base::isFALSE(flip)) {ggplot2::element_blank()},
                      axis.text.x = ggplot2::element_text(color = "black",
                                                          face = axis.text.face,
                                                          angle = get_axis_parameters(angle = axis.text.x.angle, flip = flip)[["angle"]],
                                                          hjust = get_axis_parameters(angle = axis.text.x.angle, flip = flip)[["hjust"]],
                                                          vjust = get_axis_parameters(angle = axis.text.x.angle, flip = flip)[["vjust"]]),
                      axis.text.y = ggplot2::element_text(color = "black", face = axis.text.face),
                      axis.ticks = ggplot2::element_line(color = "black"),
                      plot.title.position = "plot",
                      plot.title = ggplot2::element_text(face = plot.title.face, hjust = 0),
                      plot.subtitle = ggplot2::element_text(face = plot.subtitle.face, hjust = 0),
                      plot.caption = ggplot2::element_text(face = plot.caption.face, hjust = 1),
                      panel.grid = ggplot2::element_blank(),
                      text = ggplot2::element_text(family = font.type),
                      plot.caption.position = "plot",
                      legend.text = ggplot2::element_text(face = legend.text.face),
                      legend.position = legend.position,
                      legend.title = ggplot2::element_text(face = legend.title.face),
                      legend.justification = "center",
                      plot.margin = ggplot2::margin(t = 10, r = 10, b = 10, l = 10),
                      plot.background = ggplot2::element_rect(fill = "white", color = "white"),
                      panel.background = ggplot2::element_rect(fill = "white", color = "white"),
                      legend.background = ggplot2::element_rect(fill = "white", color = "white"),
                      strip.text = ggplot2::element_text(color = "black", face = strip.text.face),
                      strip.background = ggplot2::element_blank())
 
  if (isTRUE(return_data)){
    data <- sample@meta.data %>%
            tibble::as_tibble() %>%
            dplyr::mutate(dplyr::across(dplyr::all_of(c(group.by, split.by)), as.character),
                          "count" = 1) %>% 
            tidyr::complete(.data[[split.by]], .data[[group.by]], explicit = FALSE) %>% 
            dplyr::group_by(.data[[split.by]], .data[[group.by]]) %>%
            dplyr::summarise("n" = sum(.data$count, na.rm = TRUE),
                             "{split.by}" := unique(.data[[split.by]])) %>% 
            dplyr::reframe("n" = .data$n,
                           "freq" = .data$n / sum(.data$n),
                           "{split.by}" := unique(.data[[split.by]]),
                           "{group.by}" := unique(.data[[group.by]]))
    return(list("Plot" = p,
                "Data" = data))
  } else {
    return(p)
  }
}


================================================
FILE: R/do_BeeSwarmPlot.R
================================================
#' Generate BeeSwarm plots of ranked cells colored by gene expression or metadata.
#'
#' This function ranks cells along a continuous feature and displays them as a
#' bee swarm, colored by a second variable. Useful for visualizing continuous
#' enrichment scores across cell populations.
#'
#' @inheritParams doc_function
#' @param feature_to_rank \strong{\code{\link[base]{character}}} | Feature for which the cells are going to be ranked. Ideal case is that this feature is stored as a metadata column.
#' @param continuous_feature \strong{\code{\link[base]{logical}}} | Is the feature to rank and color for continuous? I.e: an enrichment score.
#' @param order \strong{\code{\link[base]{logical}}} | Whether to reorder the groups based on the median of the ranking.
#' @param remove_x_axis,remove_y_axis \strong{\code{\link[base]{logical}}} | Remove X axis labels and ticks from the plot.
#' @return  A ggplot2 object containing a Bee Swarm plot.
#' @export
#'
#' @example /man/examples/examples_do_BeeSwarmPlot.R
do_BeeSwarmPlot <- function(sample,
                            feature_to_rank,
                            group.by = NULL,
                            assay = NULL,
                            reduction = NULL,
                            slot = NULL,
                            continuous_feature = FALSE,
                            order = FALSE,
                            colors.use = NULL,
                            colorblind = FALSE,
                            legend.title = NULL,
                            legend.type = "colorbar",
                            legend.position = "bottom",
                            legend.framewidth = 0.5,
                            legend.tickwidth = 0.5,
                            legend.length = 20,
                            legend.width = 1,
                            legend.framecolor = "grey50",
                            legend.tickcolor = "white",
                            legend.ncol = NULL,
                            legend.icon.size = 4,
                            plot.title = NULL,
                            plot.subtitle = NULL,
                            plot.caption = NULL,
                            xlab = NULL,
                            ylab = NULL,
                            font.size = 14,
                            font.type = "sans",
                            remove_x_axis = FALSE,
                            remove_y_axis = FALSE,
                            flip = FALSE,
                            use_viridis = FALSE,
                            viridis.palette = "G",
                            viridis.direction = 1,
                            sequential.palette = "YlGnBu",
                            sequential.direction = 1,
                            verbose = TRUE,
                            raster = FALSE,
                            raster.dpi = 300,
                            plot_cell_borders = TRUE,
                            border.size = 1.5,
                            border.color = "black",
                            pt.size = 2,
                            min.cutoff = NA,
                            max.cutoff = NA,
                            na.value = "grey75",
                            number.breaks = 5,
                            plot.title.face = "bold",
                            plot.subtitle.face = "plain",
                            plot.caption.face = "italic",
                            axis.title.face = "bold",
                            axis.text.face = "plain",
                            legend.title.face = "bold",
                            legend.text.face = "plain"){
  # Add lengthy error messages.
  withr::local_options(.new = list("warning.length" = 8170))

  check_suggests(function_name = "do_BeeSwarmPlot")
  `%>%` <- magrittr::`%>%`
  # Check ggbeeswarm version:
  # nocov start
  if(utils::packageVersion("ggbeeswarm") < "0.7.1"){
    warning(paste0(add_warning(), crayon_body("Due to recent updates in ggbeeswarm package, some internal interaction with ggplot2 have changed. Please update ggbeeswarm and ggplot2 to ensure correct plotting."), call. = FALSE))
  }
  # nocov end

  # Check if the sample provided is a Seurat object.
  check_Seurat(sample = sample)
  # Check the assay.
  out <- check_and_set_assay(sample, assay = assay)
  sample <- out[["sample"]]
  assay <- out[["assay"]]
  # Check the reduction.
  reduction <- check_and_set_reduction(sample = sample, reduction = reduction)
  # Check logical parameters.
  logical_list <- list("continuous_feature" = continuous_feature,
                       "remove_x_axis" = remove_x_axis,
                       "remove_y_axis" = remove_y_axis,
                       "flip" = flip,
                       "verbose" = verbose,
                       "raster" = raster,
                       "plot_cell_borders" = plot_cell_borders,
                       "use_viridis" = use_viridis,
                       "order" = order,
                       "colorblind" = colorblind)
  check_type(parameters = logical_list, required_type = "logical", test_function = is.logical)
  # Check numeric parameters.
  numeric_list <- list("font.size" = font.size,
                       "raster.dpi" = raster.dpi,
                       "legend.framewidth" = legend.framewidth,
                       "legend.tickwidth" = legend.tickwidth,
                       "legend.length" = legend.length,
                       "legend.width" = legend.width,
                       "pt.size" = pt.size,
                       "border.size" = border.size,
                       "min.cutoff" = min.cutoff,
                       "max.cutoff" = max.cutoff,
                       "viridis.direction" = viridis.direction,
                       "legend.ncol" = legend.ncol,
                       "legend.icon.size" = legend.icon.size,
                       "number.breaks" = number.breaks,
                       "sequential.direction" = sequential.direction)
  check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric)
  # Check character parameters.
  character_list <- list("legend.position" = legend.position,
                         "legend.title" = legend.title,
                         "plot.title" = plot.title,
                         "plot.subtitle" = plot.subtitle,
                         "plot.caption" = plot.caption,
                         "feature_to_rank" = feature_to_rank,
                         "group.by" = group.by,
                         "ylab" = ylab,
                         "xlab" = xlab,
                         "slot" = slot,
                         "viridis.palette" = viridis.palette,
                         "legend.framecolor" = legend.framecolor,
                         "legend.tickcolor" = legend.tickcolor,
                         "legend.type" = legend.type,
                         "font.type" = font.type,
                         "border.color" = border.color,
                         "sequential.palette" = sequential.palette,
                         "plot.title.face" = plot.title.face,
                         "plot.subtitle.face" = plot.subtitle.face,
                         "plot.caption.face" = plot.caption.face,
                         "axis.title.face" = axis.title.face,
                         "axis.text.face" = axis.text.face,
                         "legend.title.face" = legend.title.face,
                         "legend.text.face" = legend.text.face,
                         "na.value" = na.value)
  check_type(parameters = character_list, required_type = "character", test_function = is.character)
  # Check slot.
  slot <- if(is.null(slot)){"data"} else {slot}

  # Check the colors provided to legend.framecolor and legend.tickcolor and border color.
  check_colors(legend.framecolor, parameter_name = "legend.framecolor")
  check_colors(legend.tickcolor, parameter_name = "legend.tickcolor")
  check_colors(border.color, parameter_name = "border.color")
  check_colors(na.value, parameter_name = "na.value")

  check_parameters(parameter = font.type, parameter_name = "font.type")
  check_parameters(parameter = number.breaks, parameter_name = "number.breaks")
  check_parameters(parameter = legend.type, parameter_name = "legend.type")
  check_parameters(parameter = legend.position, parameter_name = "legend.position")
  check_parameters(parameter = viridis.palette, parameter_name = "viridis.palette")
  check_parameters(parameter = sequential.palette, parameter_name = "sequential.palette")
  check_parameters(plot.title.face, parameter_name = "plot.title.face")
  check_parameters(plot.subtitle.face, parameter_name = "plot.subtitle.face")
  check_parameters(plot.caption.face, parameter_name = "plot.caption.face")
  check_parameters(axis.title.face, parameter_name = "axis.title.face")
  check_parameters(axis.text.face, parameter_name = "axis.text.face")
  check_parameters(legend.title.face, parameter_name = "legend.title.face")
  check_parameters(legend.text.face, parameter_name = "legend.text.face")
  check_parameters(viridis.direction, parameter_name = "viridis.direction")
  check_parameters(sequential.direction, parameter_name = "sequential.direction")


  assertthat::assert_that(length(feature_to_rank) == 1,
                          msg = paste0(crayon_body("Please provide only "),
                                       crayon_key("one feature"),
                                       crayon_body(" to "),
                                       crayon_key("feature_to_rank"),
                                       crayon_body(".")))

  colors.gradient <- compute_continuous_palette(name = ifelse(isTRUE(use_viridis), viridis.palette, sequential.palette),
                                                use_viridis = use_viridis,
                                                direction = ifelse(isTRUE(use_viridis), viridis.direction, sequential.direction),
                                                enforce_symmetry = FALSE)

  # Check group.by.
  out <- check_group_by(sample = sample,
                        group.by = group.by,
                        is.heatmap = FALSE)
  sample <- out[["sample"]]
  group.by <- out[["group.by"]]

  # Assign legend title.
  if (is.null(legend.title)){
    legend.title <- if (isTRUE(continuous_feature)) {feature_to_rank} else {group.by}
  }


  dim_colnames <- check_feature(sample = sample, features = feature_to_rank, dump_reduction_names = TRUE)
  if (feature_to_rank %in% colnames(sample@meta.data)) {
    sample@meta.data$rank_me <- sample@meta.data[, feature_to_rank]
    sample@meta.data$rank <- rank(sample@meta.data$rank_me)
  } else if (feature_to_rank %in% rownames(sample)){
    if (utils::packageVersion("Seurat") < "5.0.0"){
      sample@meta.data$rank_me <- SeuratObject::GetAssayData(object = sample,
                                                             assay = assay,
                                                             slot = slot)[feature_to_rank, ]
    } else {
      sample@meta.data$rank_me <- SeuratObject::GetAssayData(object = sample,
                                                             assay = assay,
                                                             layer = slot)[feature_to_rank, ]
    }
    sample@meta.data$rank <- rank(sample@meta.data$rank_me)
  } else if (feature_to_rank %in% dim_colnames){
    for(red in Seurat::Reductions(object = sample)){
      if (feature_to_rank %in% colnames(sample@reductions[[red]][[]])){
        reduction <- red
        sample@meta.data$rank_me  <- sample@reductions[[reduction]][[]][, feature_to_rank]
        sample@meta.data$rank <- rank(sample@meta.data$rank_me)
      }
    }
  }
  # Compute the ranking
  sample@meta.data$ranked_groups <- factor(sample@meta.data[, group.by], levels = sort(unique(sample@meta.data[, group.by])))

  if (isTRUE(order)){
    # Get median rank by group.
    order <- sample@meta.data %>%
             dplyr::select(dplyr::all_of(c("ranked_groups", "rank"))) %>%
             dplyr::group_by(.data$ranked_groups) %>%
             dplyr::summarise("median" = stats::median(.data$rank, na.rm = TRUE)) %>%
             dplyr::arrange(dplyr::desc(.data$median)) %>%
             dplyr::pull(.data$ranked_groups) %>%
             as.character()
    sample@meta.data$ranked_groups <- factor(sample@meta.data$ranked_groups, levels = rev(order))
  }

  color_by <- ifelse(continuous_feature == TRUE, "rank_me", "ranked_groups")


  # Compute the limits.
  if (isTRUE(continuous_feature)){
    data <- sample$rank_me
    range.data <- c(min(data, na.rm = TRUE),
                    max(data, na.rm = TRUE))

    scale.setup <- compute_scales(sample = NULL,
                                  feature = feature_to_rank,
                                  assay = NULL,
                                  reduction = NULL,
                                  slot = NULL,
                                  number.breaks = number.breaks,
                                  min.cutoff = min.cutoff,
                                  max.cutoff = max.cutoff,
                                  flavor = "Seurat",
                                  enforce_symmetry = FALSE,
                                  from_data = TRUE,
                                  limits.use = range.data)

    sample$rank_me[sample$rank_me < min.cutoff] <- min.cutoff
    sample$rank_me[sample$rank_me > max.cutoff] <- max.cutoff
  }

  p <- ggplot2::ggplot(sample@meta.data,
                       mapping = ggplot2::aes(x = .data[["rank"]],
                                              y = .data[["ranked_groups"]],
                                              color = !!rlang::sym(color_by)))

  # Add raster layer if desired.
  if (isTRUE(raster)){
    p <- p +
         ggrastr::geom_quasirandom_rast(raster.dpi = raster.dpi,
                                        size = pt.size)
  } else {
    p <- p +
         ggbeeswarm::geom_quasirandom(size = pt.size)
  }

  p <- p +
       ggplot2::labs(title = plot.title,
                     subtitle = plot.subtitle,
                     caption = plot.caption) +
       ggplot2::theme_minimal(base_size = font.size) +
       ggplot2::theme(plot.margin = ggplot2::margin(t = 10, r = 10, b = 10, l = 10),
                      plot.title = ggplot2::element_text(face = plot.title.face, hjust = 0),
                      plot.subtitle = ggplot2::element_text(face = plot.subtitle.face, hjust = 0),
                      plot.caption = ggplot2::element_text(face = plot.caption.face, hjust = 1),
                      panel.grid = ggplot2::element_blank(),
                      plot.title.position = "plot",
                      plot.caption.position = "plot",
                      text = ggplot2::element_text(family = font.type),
                      legend.text = ggplot2::element_text(face = legend.text.face),
                      legend.position = legend.position,
                      legend.title = ggplot2::element_text(face = legend.title.face),
                      legend.justification = "center",
                      axis.title.x = ggplot2::element_text(face = axis.title.face),
                      axis.title.y = ggplot2::element_text(face = axis.title.face, angle = 90),
                      axis.ticks.y = if(base::isFALSE(flip)){ggplot2::element_line(color = "black")} else {ggplot2::element_blank()},
                      axis.ticks.x = if(isTRUE(flip)){ggplot2::element_line(color = "black")} else {ggplot2::element_blank()},
                      axis.text = ggplot2::element_text(face = axis.text.face, color = "black"),
                      axis.line = ggplot2::element_line(color = "black"),
                      plot.background = ggplot2::element_rect(fill = "white", color = "white"),
                      panel.background = ggplot2::element_rect(fill = "white", color = "white"),
                      legend.background = ggplot2::element_rect(fill = "white", color = "white"))

  if (continuous_feature == TRUE){

    p <- p +
         ggplot2::scale_color_gradientn(colors = colors.gradient,
                                        na.value = na.value,
                                        name = legend.title,
                                        breaks = scale.setup$breaks,
                                        labels = scale.setup$labels,
                                        limits = scale.setup$limits)

    p <- modify_continuous_legend(p = p,
                                  legend.title = legend.title,
                                  legend.aes = "color",
                                  legend.type = legend.type,
                                  legend.position = legend.position,
                                  legend.length = legend.length,
                                  legend.width = legend.width,
                                  legend.framecolor = legend.framecolor,
                                  legend.tickcolor = legend.tickcolor,
                                  legend.framewidth = legend.framewidth,
                                  legend.tickwidth = legend.tickwidth)
  } else if (continuous_feature == FALSE) {
    if (is.null(colors.use)){
      colors.use <- generate_color_scale(levels(sample), colorblind = colorblind)
    } else {
      colors.use <- check_consistency_colors_and_names(sample = sample, colors = colors.use, grouping_variable = group.by)
    }
    # Adapt the legend to categorical variables.
    if (is.null(legend.title)){
      legend.title <- "Groups"
    }
    p <- p +
         ggplot2::scale_color_manual(values = colors.use) +
         ggplot2::guides(color = ggplot2::guide_legend(title = legend.title,
                                                       title.position = "top",
                                                       title.hjust = 0.5,
                                                       ncol = legend.ncol,
                                                       override.aes = list(size = legend.icon.size))) +
         ggplot2::theme(legend.position = legend.position)
  }

  if (base::isTRUE(remove_x_axis)){
    p <- p +
         ggplot2::theme(axis.text.x = ggplot2::element_blank(),
                        axis.ticks.x = ggplot2::element_blank())
  }
  if (base::isTRUE(remove_y_axis)){
    p <- p +
         ggplot2::theme(axis.text.y = ggplot2::element_blank(),
                        axis.ticks.y = ggplot2::element_blank())
  }
  if (base::isTRUE(flip)){
    p <- p +
         ggplot2::coord_flip() +
         ggplot2::theme(axis.text.y = ggplot2::element_blank(),
                        axis.ticks.y = ggplot2::element_blank()) +
         ggplot2::xlab(ifelse(is.null(ylab), paste0("Ranking of ", feature_to_rank), ylab)) +
         ggplot2::ylab(if(is.null(xlab)) {group.by} else {xlab})

  } else {
    p <- p +
         ggplot2::theme(axis.text.x = ggplot2::element_blank(),
                        axis.ticks.x = ggplot2::element_blank()) +
         ggplot2::xlab(ifelse(is.null(xlab), paste0("Ranking of ", feature_to_rank), xlab)) +
         ggplot2::ylab(if(is.null(ylab)) {group.by} else {ylab})

  }

  if (isTRUE(plot_cell_borders)){
    # Generate base layer.
    if (isTRUE(raster)){
      base_layer <- ggrastr::geom_quasirandom_rast(data = sample@meta.data,
                                                   mapping = ggplot2::aes(x = .data[["rank"]],
                                                                          y = .data[["ranked_groups"]]),
                                                   raster.dpi = raster.dpi,
                                                   color = border.color,
                                                   size = pt.size * border.size,
                                                   show.legend = FALSE)
    } else if (base::isFALSE(raster)){
      base_layer <-ggbeeswarm::geom_quasirandom(data = sample@meta.data,
                                                 mapping = ggplot2::aes(x = .data[["rank"]],
                                                                        y = .data[["ranked_groups"]]),
                                                 color = border.color,
                                                 size = pt.size * border.size,
                                                 show.legend = FALSE)
    }
    p[["layers"]] <- append(base_layer, p[["layers"]])

  }


  return(p)

}


================================================
FILE: R/do_BoxPlot.R
================================================

#' Generate Box Plots.
#'
#' @inheritParams doc_function
#' @inheritParams ggsignif::geom_signif
#'
#' @param boxplot.line.color \strong{\code{\link[base]{character}}} | Color of the borders of the boxplots if use_silhouette is FALSE.
#' @param outlier.color \strong{\code{\link[base]{character}}} | Color of the outlier dots.
#' @param outlier.alpha \strong{\code{\link[base]{numeric}}} | Alpha applied to the outliers.
#' @param boxplot.linewidth \strong{\code{\link[base]{numeric}}} | Width of the lines in the boxplots. Also controls the lines of the tests applied if use_test is set to true.
#' @param boxplot.width \strong{\code{\link[base]{numeric}}} | Width of the boxplots.
#' @param use_silhouette \strong{\code{\link[base]{logical}}} | Whether to color the borders of the boxplots instead of the inside area.
#' @param use_test \strong{\code{\link[base]{logical}}} | Whether to apply a statistical test to a given pair of elements. Can not be used alongside split.by.
#'
#' @return A ggplot2 object.
#' @export
#'
#' @example /man/examples/examples_do_BoxPlot.R

do_BoxPlot <- function(sample,
                       feature,
                       group.by = NULL,
                       split.by = NULL,
                       assay = NULL,
                       slot = "data",
                       font.size = 14,
                       font.type = "sans",
                       axis.text.x.angle = 45,
                       colors.use = NULL,
                       colorblind = FALSE,
                       na.value = "grey75",
                       plot.title = NULL,
                       plot.subtitle = NULL,
                       plot.caption = NULL,
                       xlab = NULL,
                       ylab = NULL,
                       legend.title = NULL,
                       legend.title.position = "top",
                       legend.position = "bottom",
                       legend.ncol = NULL,
                       legend.nrow = NULL,
                       legend.byrow = FALSE,
                       boxplot.line.color = "black",
                       outlier.color = "black",
                       outlier.alpha = 0.5,
                       boxplot.linewidth = 0.5,
                       boxplot.width = NULL,
                       plot.grid = TRUE,
                       grid.color = "grey75",
                       grid.type = "dashed",
                       flip = FALSE,
                       order = FALSE,
                       use_silhouette = FALSE,
                       use_test = FALSE,
                       comparisons = NULL,
                       test = "wilcox.test",
                       map_signif_level = c("***" = 0.001, "**" = 0.01, "*" = 0.05),
                       plot.title.face = "bold",
                       plot.subtitle.face = "plain",
                       plot.caption.face = "italic",
                       axis.title.face = "bold",
                       axis.text.face = "plain",
                       legend.title.face = "bold",
                       legend.text.face = "plain"){
  # Add lengthy error messages.
  withr::local_options(.new = list("warning.length" = 8170))

  check_suggests(function_name = "do_BoxPlot")
  # Check if the sample provided is a Seurat object.
  check_Seurat(sample = sample)

  # Check the assay.
  out <- check_and_set_assay(sample = sample, assay = assay)
  sample <- out[["sample"]]
  assay <- out[["assay"]]
  # Check slot.
  slot <- if(is.null(slot)){"data"} else {slot}
  # Check logical parameters.
  logical_list <- list("flip" = flip,
                       "plot.grid" = plot.grid,
                       "order" = order,
                       "use_silhouette" = use_silhouette,
                       "legend.byrow" = legend.byrow,
                       "colorblind" = colorblind)
  check_type(parameters = logical_list, required_type = "logical", test_function = is.logical)
  # Check numeric parameters.
  numeric_list <- list("font.size" = font.size,
                       "outlier.alpha" = outlier.alpha,
                       "boxplot.linewidth" = boxplot.linewidth,
                       "boxplot.width" = boxplot.width,
                       "axis.text.x.angle" = axis.text.x.angle,
                       "legend.nrow" = legend.nrow,
                       "legend.ncol" = legend.ncol)
  check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric)
  # Check character parameters.
  character_list <- list("feature" = feature,
                         "group.by" = group.by,
                         "split.by" = split.by,
                         "assay" = assay,
                         "slot" = slot,
                         "font.type" = font.type,
                         "colors.use" = colors.use,
                         "plot.title" = plot.title,
                         "plot.subtitle" = plot.subtitle,
                         "plot.caption" = plot.caption,
                         "xlab" = xlab,
                         "ylab" = ylab,
                         "legend.title" = legend.title,
                         "legend.title.position" = legend.title.position,
                         "legend.position" = legend.position,
                         "boxplot.line.color" = boxplot.line.color,
                         "outlier.color" = outlier.color,
                         "grid.color" = grid.color,
                         "grid.type" = grid.type,
                         "comparisons" = comparisons,
                         "test" = test,
                         "plot.title.face" = plot.title.face,
                         "plot.subtitle.face" = plot.subtitle.face,
                         "plot.caption.face" = plot.caption.face,
                         "axis.title.face" = axis.title.face,
                         "axis.text.face" = axis.text.face,
                         "legend.title.face" = legend.title.face,
                         "legend.text.face" = legend.text.face)
  check_type(parameters = character_list, required_type = "character", test_function = is.character)

  # Check the feature.
  feature <- check_feature(sample = sample, features = feature, permissive = TRUE)

  `%>%` <- magrittr::`%>%`
  
  
  check_colors(na.value, parameter_name = "na.value")
  check_colors(boxplot.line.color, parameter_name = "boxplot.line.color")
  check_colors(outlier.color, parameter_name = "outlier.color")
  check_colors(grid.color, parameter_name = "grid.color")

  check_parameters(parameter = font.type, parameter_name = "font.type")
  check_parameters(parameter = legend.position, parameter_name = "legend.position")
  check_parameters(parameter = grid.type, parameter_name = "grid.type")
  check_parameters(parameter = axis.text.x.angle, parameter_name = "axis.text.x.angle")
  check_parameters(plot.title.face, parameter_name = "plot.title.face")
  check_parameters(plot.subtitle.face, parameter_name = "plot.subtitle.face")
  check_parameters(plot.caption.face, parameter_name = "plot.caption.face")
  check_parameters(axis.title.face, parameter_name = "axis.title.face")
  check_parameters(axis.text.face, parameter_name = "axis.text.face")
  check_parameters(legend.title.face, parameter_name = "legend.title.face")
  check_parameters(legend.text.face, parameter_name = "legend.text.face")
  
  if (is.null(legend.title)){
    if (is.null(split.by)){
      if (is.null(group.by)) {
        legend.title <- "Groups"
      } else {
        legend.title <- group.by
      }
    } else {
      legend.title <- split.by
    }
  }
  
  # Check group.by.
  out <- check_group_by(sample = sample,
                        group.by = group.by,
                        is.heatmap = FALSE)
  sample <- out[["sample"]]
  group.by <- out[["group.by"]]
  
  # Custom function to draw black border in legend.
  # Define the custom draw_key function
  draw_key_square_black_border <- function(data, 
                                           params, 
                                           size) {
    grid::rectGrob(width = grid::unit(1, "npc"),        # Full size of the key (square)
                  height = grid::unit(1, "npc"),
                  gp = grid::gpar(col = "black", # Black border
                                  fill = ggplot2::alpha(data$fill, data$alpha),  # Fill with specified color and alpha
                                  lwd = 1)  # Border line width
    )
  }
  
  if (is.null(colors.use)){
    if (is.null(split.by)){
      colors.use <- generate_color_scale(names_use = if (is.factor(sample@meta.data[, group.by])) {
        levels(sample@meta.data[, group.by])
      } else {
        sort(unique(sample@meta.data[, group.by]))
      }, colorblind = colorblind)
    } else {
      colors.use <- generate_color_scale(names_use = if (is.factor(sample@meta.data[, split.by])) {levels(sample@meta.data[, split.by])} else {sort(unique(sample@meta.data[, split.by]))}, colorblind = colorblind)
    }
  } else {
    check_colors(colors.use, parameter_name = "colors.use")
    check_consistency_colors_and_names(sample = sample, colors = colors.use, grouping_variable = ifelse(!is.null(split.by), split.by, group.by))
  }

  data <- get_data_column_in_context(sample,
                                     feature = feature,
                                     assay = assay,
                                     slot = slot,
                                     group.by = group.by,
                                     split.by = split.by)
  if (isTRUE(order) & is.null(split.by)){
    data <- data %>%
      dplyr::mutate("group.by" = factor(as.character(.data[["group.by"]]),
                                        levels = {data %>%
                                                  tibble::as_tibble() %>%
                                                  dplyr::group_by(.data[["group.by"]]) %>%
                                                  dplyr::summarise("median" = stats::median(.data[["feature"]], na.rm = TRUE)) %>%
                                                  dplyr::arrange(if(base::isFALSE(flip)){dplyr::desc(.data[["median"]])} else {.data[["median"]]}) %>%
                                                  dplyr::pull(.data[["group.by"]]) %>%
                                                  as.character()}))
  }
  if (isTRUE(order)){
    assertthat::assert_that(is.null(split.by),
                            msg = paste0(add_cross(), crayon_body("Parameter "),
                                         crayon_key("split.by"),
                                         crayon_body(" cannot be used alonside "),
                                         crayon_key("order"),
                                         crayon_body(".")))
  }

  if (!is.null(split.by)){
    assertthat::assert_that(base::isFALSE(order),
                            msg = paste0(add_cross(), crayon_body("Parameter "),
                                         crayon_key("split.by"),
                                         crayon_body(" cannot be used alonside "),
                                         crayon_key("order"),
                                         crayon_body(".")))
  }
  
  
  if (!is.null(map_signif_level)){
    assertthat::assert_that(base::isTRUE(is.logical(map_signif_level) | is.numeric(map_signif_level)),
                            msg = paste0(add_cross(), crayon_body("Parameter "),
                                         crayon_key("map_signif_level"),
                                         crayon_body(" needs to be a "),
                                         crayon_key("logical"),
                                         crayon_body(" or a "),
                                         crayon_key("custom mapping"),
                                         crayon_body(" such as "),
                                         crayon_key('c("***" = 0.001, "**" = 0.01, "*" = 0.05)'),
                                         crayon_body(".")))
  }
  
  if (isTRUE(use_silhouette) & is.null(split.by)){
    p <- data %>%
         ggplot2::ggplot(mapping = ggplot2::aes(x = .data[["group.by"]],
                                                y = .data[["feature"]],
                                                color = .data[["group.by"]])) +
         ggplot2::scale_color_manual(values = colors.use, na.value = na.value) +
         ggplot2::geom_boxplot(outlier.color = outlier.color,
                               outlier.alpha = outlier.alpha,
                               width = boxplot.width,
                               lwd = boxplot.linewidth,
                               fatten = 1,
                               na.rm = TRUE)   +
         ggplot2::guides(color = ggplot2::guide_legend(title = legend.title,
                                                       title.position = legend.title.position,
                                                       title.hjust = 0.5,
                                                       ncol = legend.ncol,
                                                       nrow = legend.nrow,
                                                       byrow = legend.byrow))
  } else if (isTRUE(use_silhouette) & !is.null(split.by)){
    stop(paste0(add_cross(), crayon_body("Parameter "), crayon_key("use_silhouette"),  crayon_body("can not be used alongside "), crayon_key("split.by"), crayon_body(".")), call. = FALSE)
  } else if (base::isFALSE(use_silhouette)){
    if (is.null(split.by)){
      p <- data %>%
           ggplot2::ggplot(mapping = ggplot2::aes(x = .data[["group.by"]],
                                                  y = .data[["feature"]],
                                                  fill = .data[["group.by"]]))
    } else {
      p <- data %>%
           ggplot2::ggplot(mapping = ggplot2::aes(x = .data[["group.by"]],
                                                  y = .data[["feature"]],
                                                  fill = .data[["split.by"]]))
    }
    p <- p +
         ggplot2::scale_fill_manual(values = colors.use, na.value = na.value) +
         ggplot2::geom_boxplot(color = boxplot.line.color,
                               outlier.color = outlier.color,
                               outlier.alpha = outlier.alpha,
                               width = boxplot.width,
                               lwd = boxplot.linewidth,
                               fatten = 1,
                               key_glyph = draw_key_square_black_border,
                               na.rm = TRUE)   +
         ggplot2::guides(fill = ggplot2::guide_legend(title = legend.title,
                                                      title.position = legend.title.position,
                                                      title.hjust = 0.5,
                                                      ncol = legend.ncol,
                                                      nrow = legend.nrow,
                                                      byrow = legend.byrow))
  }

   p <- p +
        ggplot2::labs(title = plot.title,
                      subtitle = plot.subtitle,
                      caption = plot.caption) +
        ggplot2::xlab(if (is.null(xlab)) {"Groups"} else (xlab)) +
        ggplot2::ylab(if (is.null(ylab)) {feature} else (ylab)) +
        ggplot2::theme_minimal(base_size = font.size) +
        ggplot2::theme(axis.title = ggplot2::element_text(color = "black",
                                                          face = axis.title.face),
                       axis.line.x = if (base::isFALSE(flip)) {ggplot2::element_line(color = "black")} else if (isTRUE(flip)) {ggplot2::element_blank()},
                       axis.line.y = if (isTRUE(flip)) {ggplot2::element_line(color = "black")} else if (base::isFALSE(flip)) {ggplot2::element_blank()},
                       axis.text.x = ggplot2::element_text(color = "black",
                                                           face = axis.text.face,
                                                           angle = get_axis_parameters(angle = axis.text.x.angle, flip = flip)[["angle"]],
                                                           hjust = get_axis_parameters(angle = axis.text.x.angle, flip = flip)[["hjust"]],
                                                           vjust = get_axis_parameters(angle = axis.text.x.angle, flip = flip)[["vjust"]]),
                       axis.text.y = ggplot2::element_text(color = "black", face = axis.text.face),
                       axis.ticks = ggplot2::element_line(color = "black"),
                       panel.grid.major = ggplot2::element_blank(),
                       panel.grid.major.y = if (base::isFALSE(flip)) {if (isTRUE(plot.grid)){ggplot2::element_line(color = grid.color, linetype = grid.type)}} else if (isTRUE(flip)) {ggplot2::element_blank()},
                       panel.grid.major.x = if (isTRUE(flip)) {if (isTRUE(plot.grid)){ggplot2::element_line(color = grid.color, linetype = grid.type)}} else if (base::isFALSE(flip)) {ggplot2::element_blank()},
                       plot.title.position = "plot",
                       plot.title = ggplot2::element_text(face = plot.title.face, hjust = 0),
                       plot.subtitle = ggplot2::element_text(face = plot.subtitle.face, hjust = 0),
                       plot.caption = ggplot2::element_text(face = plot.caption.face, hjust = 1),
                       legend.text = ggplot2::element_text(face = legend.text.face),
                       legend.title = ggplot2::element_text(face = legend.title.face),
                       panel.grid = ggplot2::element_blank(),
                       text = ggplot2::element_text(family = font.type),
                       plot.caption.position = "plot",
                       legend.position = legend.position,
                       legend.justification = "center",
                       plot.margin = ggplot2::margin(t = 10, r = 10, b = 10, l = 10),
                       plot.background = ggplot2::element_rect(fill = "white", color = "white"),
                       panel.background = ggplot2::element_rect(fill = "white", color = "white"),
                       legend.background = ggplot2::element_rect(fill = "white", color = "white"),
                       strip.text =ggplot2::element_text(color = "black", face = "bold"))

  if (isTRUE(flip)){
    p <- p + ggplot2::coord_flip()
  }

  if (isTRUE(use_test) & is.null(split.by)){
    if (!(is.null(comparisons))){
      p <- p +
           ggsignif::geom_signif(comparisons = comparisons,
                                 map_signif_level = map_signif_level,
                                 test = test,
                                 color = "black",
                                 size = boxplot.linewidth,
                                 textsize = font.size - 8,
                                 family = font.type,
                                 fontface = "bold")
      
      if (!is.logical(map_signif_level)){
        caption <- c()
        for (i in seq_len(length(map_signif_level))){caption <- append(caption, paste0(names(map_signif_level)[i], " = ", format(map_signif_level[i], scientific = FALSE)))}
        caption <- paste(caption, collapse = ", ")
        
        p <- p + ggplot2::labs(caption = caption)
      }
    } else {
Download .txt
gitextract_myymkbek/

├── .Rbuildignore
├── .github/
│   ├── .gitignore
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug-report.md
│   │   └── feature-request.md
│   └── workflows/
│       ├── R-CMD-check.yaml
│       └── test-coverage.yaml
├── .gitignore
├── CRAN-SUBMISSION
├── DESCRIPTION
├── LICENSE.md
├── NAMESPACE
├── NEWS.md
├── R/
│   ├── data.R
│   ├── do_ActivityHeatmap.R
│   ├── do_AlluvialPlot.R
│   ├── do_BarPlot.R
│   ├── do_BeeSwarmPlot.R
│   ├── do_BoxPlot.R
│   ├── do_CNVHeatmap.R
│   ├── do_CellularStatesPlot.R
│   ├── do_ChordDiagramPlot.R
│   ├── do_ColorBlindCheck.R
│   ├── do_ColorPalette.R
│   ├── do_CorrelationHeatmap.R
│   ├── do_DimPlot.R
│   ├── do_DotPlot.R
│   ├── do_EnrichmentHeatmap.R
│   ├── do_ExpressionHeatmap.R
│   ├── do_FeaturePlot.R
│   ├── do_GroupwiseDEHeatmap.R
│   ├── do_LigandReceptorPlot.R
│   ├── do_LoadingsHeatmap.R
│   ├── do_MetadataHeatmap.R
│   ├── do_NebulosaPlot.R
│   ├── do_PathwayActivityHeatmap.R
│   ├── do_RankedEnrichmentHeatmap.R
│   ├── do_RankedExpressionHeatmap.R
│   ├── do_RidgePlot.R
│   ├── do_SCEnrichmentHeatmap.R
│   ├── do_SCExpressionHeatmap.R
│   ├── do_StripPlot.R
│   ├── do_TFActivityHeatmap.R
│   ├── do_TermEnrichmentPlot.R
│   ├── do_ViolinPlot.R
│   ├── do_VolcanoPlot.R
│   ├── do_WafflePlot.R
│   ├── globals.R
│   ├── plot_density_patch.R
│   ├── utils.R
│   └── zzz.R
├── README.md
├── cran-comments.md
├── data/
│   └── human_chr_locations.rda
├── inst/
│   ├── CITATION
│   └── extdata/
│       ├── de_genes_example.rds
│       ├── dorothea_activities_example.rds
│       ├── enriched_terms_example.rds
│       ├── genes_example.rds
│       ├── infercnv_object_example.rds
│       ├── infercnv_object_metacells_example.rds
│       ├── liana_output_example.rds
│       ├── metacell_mapping_example.rds
│       ├── progeny_activities_example.rds
│       └── seurat_dataset_example.rds
├── man/
│   ├── do_ActivityHeatmap.Rd
│   ├── do_AlluvialPlot.Rd
│   ├── do_BarPlot.Rd
│   ├── do_BeeSwarmPlot.Rd
│   ├── do_BoxPlot.Rd
│   ├── do_CNVHeatmap.Rd
│   ├── do_CellularStatesPlot.Rd
│   ├── do_ChordDiagramPlot.Rd
│   ├── do_ColorBlindCheck.Rd
│   ├── do_ColorPalette.Rd
│   ├── do_CorrelationHeatmap.Rd
│   ├── do_DimPlot.Rd
│   ├── do_DotPlot.Rd
│   ├── do_EnrichmentHeatmap.Rd
│   ├── do_ExpressionHeatmap.Rd
│   ├── do_FeaturePlot.Rd
│   ├── do_GroupwiseDEHeatmap.Rd
│   ├── do_LigandReceptorPlot.Rd
│   ├── do_LoadingsHeatmap.Rd
│   ├── do_MetadataHeatmap.Rd
│   ├── do_NebulosaPlot.Rd
│   ├── do_PackageReport.Rd
│   ├── do_PathwayActivityHeatmap.Rd
│   ├── do_RankedEnrichmentHeatmap.Rd
│   ├── do_RankedExpressionHeatmap.Rd
│   ├── do_RidgePlot.Rd
│   ├── do_SCEnrichmentHeatmap.Rd
│   ├── do_SCExpressionHeatmap.Rd
│   ├── do_StripPlot.Rd
│   ├── do_TFActivityHeatmap.Rd
│   ├── do_TermEnrichmentPlot.Rd
│   ├── do_ViolinPlot.Rd
│   ├── do_VolcanoPlot.Rd
│   ├── do_WafflePlot.Rd
│   ├── doc_function.Rd
│   ├── examples/
│   │   ├── examples_do_ActivityHeatmap.R
│   │   ├── examples_do_AlluvialPlot.R
│   │   ├── examples_do_BarPlot.R
│   │   ├── examples_do_BeeSwarmPlot.R
│   │   ├── examples_do_BoxPlot.R
│   │   ├── examples_do_CNVHeatmap.R
│   │   ├── examples_do_CellularStatesPlot.R
│   │   ├── examples_do_ChordDiagramPlot.R
│   │   ├── examples_do_ColorBlindCheck.R
│   │   ├── examples_do_ColorPalette.R
│   │   ├── examples_do_CorrelationHeatmap.R
│   │   ├── examples_do_DimPlot.R
│   │   ├── examples_do_DotPlot.R
│   │   ├── examples_do_EnrichmentHeatmap.R
│   │   ├── examples_do_ExpressionHeatmap.R
│   │   ├── examples_do_FeaturePlot.R
│   │   ├── examples_do_GroupwiseDEHeatmap.R
│   │   ├── examples_do_LigandReceptorPlot.R
│   │   ├── examples_do_LoadingsHeatmap.R
│   │   ├── examples_do_MetadataHeatmap.R
│   │   ├── examples_do_NebulosaPlot.R
│   │   ├── examples_do_PathwayActivityHeatmap.R
│   │   ├── examples_do_RankedEnrichmentHeatmap.R
│   │   ├── examples_do_RankedExpressionHeatmap.R
│   │   ├── examples_do_RidgePlot.R
│   │   ├── examples_do_SCEnrichmentHeatmap.R
│   │   ├── examples_do_SCExpressionHeatmap.R
│   │   ├── examples_do_StripPlot.R
│   │   ├── examples_do_TFActivityHeatmap.R
│   │   ├── examples_do_TermEnrichmentPlot.R
│   │   ├── examples_do_ViolinPlot.R
│   │   ├── examples_do_VolcanoPlot.R
│   │   └── examples_do_WafflePlot.R
│   ├── human_chr_locations.Rd
│   ├── named_list.Rd
│   └── named_vector.Rd
├── revdep/
│   ├── .gitignore
│   └── email.yml
├── tests/
│   ├── testthat/
│   │   ├── setup.R
│   │   ├── test-do_ActivityHeatmap.R
│   │   ├── test-do_AlluvialPlot.R
│   │   ├── test-do_BarPlot.R
│   │   ├── test-do_BeeSwarmPlot.R
│   │   ├── test-do_BoxPlot.R
│   │   ├── test-do_CNVHeatmap.R
│   │   ├── test-do_CellularStatesPlot.R
│   │   ├── test-do_ChordDiagramPlot.R
│   │   ├── test-do_ColorBlindCheck.R
│   │   ├── test-do_ColorPalette.R
│   │   ├── test-do_CorrelationHeatmap.R
│   │   ├── test-do_DimPlot.R
│   │   ├── test-do_DotPlot.R
│   │   ├── test-do_EnrichmentHeatmap.R
│   │   ├── test-do_ExpressionHeatmap.R
│   │   ├── test-do_FeaturePlot.R
│   │   ├── test-do_GroupwiseDEHeatmap.R
│   │   ├── test-do_LigandReceptorPlot.R
│   │   ├── test-do_LoadingsHeatmap.R
│   │   ├── test-do_MetadataHeatmap.R
│   │   ├── test-do_NebulosaPlot.R
│   │   ├── test-do_PathwayActivityHeatmap.R
│   │   ├── test-do_RankedEnrichmentHeatmap.R
│   │   ├── test-do_RankedExpressionHeatmap.R
│   │   ├── test-do_RidgePlot.R
│   │   ├── test-do_SCEnrichmentHeatmap.R
│   │   ├── test-do_SCExpressionHeatmap.R
│   │   ├── test-do_StripPlot.R
│   │   ├── test-do_TFActivityHeatmap.R
│   │   ├── test-do_TermEnrichmentPlot.R
│   │   ├── test-do_ViolinPlot.R
│   │   ├── test-do_VolcanoPlot.R
│   │   ├── test-do_WafflePlot.R
│   │   └── test-utils.R
│   └── testthat.R
└── vignettes/
    ├── .gitignore
    └── reference_manual.Rmd
Condensed preview — 175 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,980K chars).
[
  {
    "path": ".Rbuildignore",
    "chars": 421,
    "preview": "^.*\\.Rproj$\n^\\.Rproj\\.user$\n^LICENSE\\.md$\n^.mailmap$\n^\\.github$\n^doc$\n^Meta$\n^codecov\\.yml$\n^.*\\.Rproj$\n^\\.Rproj\\.user$\n"
  },
  {
    "path": ".github/.gitignore",
    "chars": 7,
    "preview": "*.html\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.md",
    "chars": 1483,
    "preview": "---\nname: \"\\U0001F41B | Bug report\"\nabout: 'Found a bug?! '\ntitle: BUG | FUNCTION NAME | BRIEF DESCRIPTION\nlabels: bug\na"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature-request.md",
    "chars": 1559,
    "preview": "---\nname: \"\\U0001F4AD | Feature request\"\nabout: Do you have a cool idea you wish to be added to SCpubr?\ntitle: REQUEST |"
  },
  {
    "path": ".github/workflows/R-CMD-check.yaml",
    "chars": 1396,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".github/workflows/test-coverage.yaml",
    "chars": 1812,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".gitignore",
    "chars": 508,
    "preview": ".Rproj.user\n.Rhistory\n.RData\n.Ruserdata\ninst/doc\nSCpubr.Rproj\n/doc/\n/Meta/\n.renviron\n.rprofile\n.rproj\n.rproj.user\n.rhist"
  },
  {
    "path": "CRAN-SUBMISSION",
    "chars": 91,
    "preview": "Version: 3.0.1\nDate: 2026-01-09 14:31:18 UTC\nSHA: 06d205ffb706dae9d0889dbd0bd0503f944a28d4\n"
  },
  {
    "path": "DESCRIPTION",
    "chars": 1818,
    "preview": "Type: Package\nPackage: SCpubr\nTitle: Generate Publication Ready Visualizations of Single Cell\n    Transcriptomics Data\nV"
  },
  {
    "path": "LICENSE.md",
    "chars": 34739,
    "preview": "GNU General Public License\n==========================\n\n_Version 3, 29 June 2007_  \n_Copyright © 2007 Free Software Found"
  },
  {
    "path": "NAMESPACE",
    "chars": 936,
    "preview": "# Generated by roxygen2: do not edit by hand\n\nexport(do_ActivityHeatmap)\nexport(do_AlluvialPlot)\nexport(do_BarPlot)\nexpo"
  },
  {
    "path": "NEWS.md",
    "chars": 46272,
    "preview": "# SCpubr v3.0.2 (In Development)\n\n## Bug fixes\n-   Fixed bug in `do_DotPlot()` where passing metadata columns (e.g., UCe"
  },
  {
    "path": "R/data.R",
    "chars": 393,
    "preview": "#' Chromosome arm locations for human genome GRCh38.\n#'\n#' A tibble containing the chromosome, arm and start and end coo"
  },
  {
    "path": "R/do_ActivityHeatmap.R",
    "chars": 27678,
    "preview": "#' Compute affinity of gene sets to cell populations using decoupleR.\n#'\n#' Major contributions to this function:\n#' - \\"
  },
  {
    "path": "R/do_AlluvialPlot.R",
    "chars": 18121,
    "preview": "#' Generate Alluvial plots.\n#'\n#' This function is based on the \\pkg{ggalluvial} package. It allows you to generate allu"
  },
  {
    "path": "R/do_BarPlot.R",
    "chars": 20738,
    "preview": "\n#' Create Bar Plots.\n#'\n#' @inheritParams doc_function\n#' @param group.by \\strong{\\code{\\link[base]{character}}} | Meta"
  },
  {
    "path": "R/do_BeeSwarmPlot.R",
    "chars": 20443,
    "preview": "#' Generate BeeSwarm plots of ranked cells colored by gene expression or metadata.\n#'\n#' This function ranks cells along"
  },
  {
    "path": "R/do_BoxPlot.R",
    "chars": 19650,
    "preview": "\n#' Generate Box Plots.\n#'\n#' @inheritParams doc_function\n#' @inheritParams ggsignif::geom_signif\n#'\n#' @param boxplot.l"
  },
  {
    "path": "R/do_CNVHeatmap.R",
    "chars": 26893,
    "preview": "#' Display CNV scores from inferCNV as Feature Plots.\n#'\n#'\n#' @inheritParams doc_function\n#' @param infercnv_object \\st"
  },
  {
    "path": "R/do_CellularStatesPlot.R",
    "chars": 38655,
    "preview": "#' Plot relationships between enrichment scores to infer cellular states.\n#'\n#' This plot aims to show the relationships"
  },
  {
    "path": "R/do_ChordDiagramPlot.R",
    "chars": 15711,
    "preview": "#' Generate a Chord diagram.\n#'\n#' @inheritParams doc_function\n#' @inheritParams circlize::chordDiagram\n#' @param from,t"
  },
  {
    "path": "R/do_ColorBlindCheck.R",
    "chars": 9907,
    "preview": "#' Generate colorblind variations of a given color palette.\n#'\n#' This function generate colorblind variations of a prov"
  },
  {
    "path": "R/do_ColorPalette.R",
    "chars": 17518,
    "preview": "#' Generate color scales based on a value.\n#'\n#' This function is an adaptation of colortools package. As the package wa"
  },
  {
    "path": "R/do_CorrelationHeatmap.R",
    "chars": 29349,
    "preview": "#' Create correlation matrix heatmaps.\n#'\n#' @inheritParams doc_function\n#' @param mode \\strong{\\code{\\link[base]{charac"
  },
  {
    "path": "R/do_DimPlot.R",
    "chars": 60592,
    "preview": "#' Generate dimensional reduction plots from a Seurat object.\n#'\n#' This function wraps \\link[Seurat]{DimPlot}, adding p"
  },
  {
    "path": "R/do_DotPlot.R",
    "chars": 28500,
    "preview": "#' Generate Dot plots of gene expression across cell groups.\n#'\n#' This function generates dot plots using ggplot2, disp"
  },
  {
    "path": "R/do_EnrichmentHeatmap.R",
    "chars": 29775,
    "preview": "#' Create enrichment scores heatmaps.\n#'\n#' This function computes the enrichment scores for the cells using \\link[Seura"
  },
  {
    "path": "R/do_ExpressionHeatmap.R",
    "chars": 23838,
    "preview": "#' Create heatmaps of averaged expression by groups.\n#'\n#' This function generates a heatmap with averaged expression va"
  },
  {
    "path": "R/do_FeaturePlot.R",
    "chars": 63049,
    "preview": "#' Plot gene expression on dimensional reduction embeddings.\n#'\n#' This function wraps \\link[Seurat]{FeaturePlot}, addin"
  },
  {
    "path": "R/do_GroupwiseDEHeatmap.R",
    "chars": 34034,
    "preview": "#' Compute a dotplot with the results of a group-wise DE analysis.\n#'\n#' @inheritParams doc_function\n#' @param de_genes "
  },
  {
    "path": "R/do_LigandReceptorPlot.R",
    "chars": 33217,
    "preview": "#' Visualize Ligand-Receptor analysis output.\n#'\n#' This function takes a tibble produced by the liana package and gener"
  },
  {
    "path": "R/do_LoadingsHeatmap.R",
    "chars": 27452,
    "preview": "#' Compute a heatmap summary of the top and bottom genes in the PCA loadings for the desired PCs in a Seurat object.\n#'\n"
  },
  {
    "path": "R/do_MetadataHeatmap.R",
    "chars": 19559,
    "preview": "#' Compute a heatmap of categorical variables.\n#' \n#' The main use of this function is to generate a metadata heatmap of"
  },
  {
    "path": "R/do_NebulosaPlot.R",
    "chars": 21099,
    "preview": "#' Plot kernel density estimates of gene expression on dimensional reduction embeddings.\n#'\n#' This function wraps \\link"
  },
  {
    "path": "R/do_PathwayActivityHeatmap.R",
    "chars": 25660,
    "preview": "#' Plot Pathway Activities from decoupleR using Progeny prior knowledge.\n#'\n#' @inheritParams doc_function\n#' @param act"
  },
  {
    "path": "R/do_RankedEnrichmentHeatmap.R",
    "chars": 24743,
    "preview": "#' Compute a heatmap of enrichment of gene sets on the context of a dimensional reduction component.\n#'\n#' @inheritParam"
  },
  {
    "path": "R/do_RankedExpressionHeatmap.R",
    "chars": 23250,
    "preview": "#' Compute a heatmap of expression of genes on the context of a dimensional reduction component.\n#'\n#' @inheritParams do"
  },
  {
    "path": "R/do_RidgePlot.R",
    "chars": 14578,
    "preview": "#' Create ridge plots.\n#'\n#' This function computes ridge plots based on the \\pkg{ggridges} package.\n#'\n#' @inheritParam"
  },
  {
    "path": "R/do_SCEnrichmentHeatmap.R",
    "chars": 34158,
    "preview": "#' Perform a single-cell-based heatmap showing the enrichment in a list of gene sets.\n#'\n#' This function is heavily ins"
  },
  {
    "path": "R/do_SCExpressionHeatmap.R",
    "chars": 30280,
    "preview": "#' Perform a single-cell-based heatmap showing the expression of genes.\n#'\n#' This function is heavily inspired by \\stro"
  },
  {
    "path": "R/do_StripPlot.R",
    "chars": 27006,
    "preview": "#' Generate a Strip plot.\n#'\n#' A strip plot is a scatter plot in which we plot continuous values on the Y axis grouped "
  },
  {
    "path": "R/do_TFActivityHeatmap.R",
    "chars": 27466,
    "preview": "#' Plot TF Activities from decoupleR using Dorothea prior knowledge.\n#'\n#'\n#' @inheritParams doc_function\n#' @param acti"
  },
  {
    "path": "R/do_TermEnrichmentPlot.R",
    "chars": 14720,
    "preview": "#' Display the enriched terms for a given list of genes.\n#'\n#' @inheritParams doc_function\n#' @param mat \\strong{\\code{\\"
  },
  {
    "path": "R/do_ViolinPlot.R",
    "chars": 19678,
    "preview": "#' Generate Violin plots from a Seurat object.\n#'\n#' This function generates violin plots using ggplot2, with publicatio"
  },
  {
    "path": "R/do_VolcanoPlot.R",
    "chars": 13559,
    "preview": "#' Compute a Volcano plot out of DE genes.\n#'\n#' @inheritParams doc_function\n#' @param de_genes \\strong{\\code{\\link[tibb"
  },
  {
    "path": "R/do_WafflePlot.R",
    "chars": 9269,
    "preview": "#' Generate Waffle plots to display cell group proportions.\n#'\n#' This function displays the proportional composition of"
  },
  {
    "path": "R/globals.R",
    "chars": 413,
    "preview": "# Declare .data as global variable to avoid R CMD checks.\nutils::globalVariables(c(\".data\",\n                        \".en"
  },
  {
    "path": "R/plot_density_patch.R",
    "chars": 1461,
    "preview": "#' Compatibility wrapper for Nebulosa with SeuratObject 5.0.0+\n#'\n#' Nebulosa is not compatible with SeuratObject >= 5.0"
  },
  {
    "path": "R/utils.R",
    "chars": 165784,
    "preview": "#' Mock function used to document all main function.\n#'\n#' @param sample \\strong{\\code{\\link[SeuratObject]{Seurat}}} | A"
  },
  {
    "path": "R/zzz.R",
    "chars": 254,
    "preview": "# Add Start-Up message.\n.onAttach <- function(...) {\n  # nocov start\n  if (base::isFALSE(getOption(\"SCpubr.verbose\"))){\n"
  },
  {
    "path": "README.md",
    "chars": 2846,
    "preview": "# SCpubr <a href=\"https://github.com/enblacar/SCpubr\"><img src=\"man/figures/SCpubr_Logo512.png\" align=\"right\" height=\"20"
  },
  {
    "path": "cran-comments.md",
    "chars": 566,
    "preview": "# Resubmission version 3.0.1\nFixed notes resulting from the previous CRAN submission.\n\n# Submission version 3.0.1\nCRAN R"
  },
  {
    "path": "inst/CITATION",
    "chars": 598,
    "preview": "citHeader(\"To cite SCpubr in publications use:\")\n\nbibentry(\n  bibtype    = \"Article\",\n  title    = \"Generating publicati"
  },
  {
    "path": "man/do_ActivityHeatmap.Rd",
    "chars": 9816,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_ActivityHeatmap.R\n\\name{do_ActivityHeat"
  },
  {
    "path": "man/do_AlluvialPlot.Rd",
    "chars": 7672,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_AlluvialPlot.R\n\\name{do_AlluvialPlot}\n\\"
  },
  {
    "path": "man/do_BarPlot.Rd",
    "chars": 8104,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_BarPlot.R\n\\name{do_BarPlot}\n\\alias{do_B"
  },
  {
    "path": "man/do_BeeSwarmPlot.Rd",
    "chars": 9746,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_BeeSwarmPlot.R\n\\name{do_BeeSwarmPlot}\n\\"
  },
  {
    "path": "man/do_BoxPlot.Rd",
    "chars": 9112,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_BoxPlot.R\n\\name{do_BoxPlot}\n\\alias{do_B"
  },
  {
    "path": "man/do_CNVHeatmap.Rd",
    "chars": 9142,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_CNVHeatmap.R\n\\name{do_CNVHeatmap}\n\\alia"
  },
  {
    "path": "man/do_CellularStatesPlot.Rd",
    "chars": 12281,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_CellularStatesPlot.R\n\\name{do_CellularS"
  },
  {
    "path": "man/do_ChordDiagramPlot.Rd",
    "chars": 5951,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_ChordDiagramPlot.R\n\\name{do_ChordDiagra"
  },
  {
    "path": "man/do_ColorBlindCheck.Rd",
    "chars": 2855,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_ColorBlindCheck.R\n\\name{do_ColorBlindCh"
  },
  {
    "path": "man/do_ColorPalette.Rd",
    "chars": 5663,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_ColorPalette.R\n\\name{do_ColorPalette}\n\\"
  },
  {
    "path": "man/do_CorrelationHeatmap.Rd",
    "chars": 8117,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_CorrelationHeatmap.R\n\\name{do_Correlati"
  },
  {
    "path": "man/do_DimPlot.Rd",
    "chars": 12378,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_DimPlot.R\n\\name{do_DimPlot}\n\\alias{do_D"
  },
  {
    "path": "man/do_DotPlot.Rd",
    "chars": 9305,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_DotPlot.R\n\\name{do_DotPlot}\n\\alias{do_D"
  },
  {
    "path": "man/do_EnrichmentHeatmap.Rd",
    "chars": 10551,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_EnrichmentHeatmap.R\n\\name{do_Enrichment"
  },
  {
    "path": "man/do_ExpressionHeatmap.Rd",
    "chars": 8405,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_ExpressionHeatmap.R\n\\name{do_Expression"
  },
  {
    "path": "man/do_FeaturePlot.Rd",
    "chars": 15231,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_FeaturePlot.R\n\\name{do_FeaturePlot}\n\\al"
  },
  {
    "path": "man/do_GroupwiseDEHeatmap.Rd",
    "chars": 8795,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_GroupwiseDEHeatmap.R\n\\name{do_Groupwise"
  },
  {
    "path": "man/do_LigandReceptorPlot.Rd",
    "chars": 9257,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_LigandReceptorPlot.R\n\\name{do_LigandRec"
  },
  {
    "path": "man/do_LoadingsHeatmap.Rd",
    "chars": 7240,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_LoadingsHeatmap.R\n\\name{do_LoadingsHeat"
  },
  {
    "path": "man/do_MetadataHeatmap.Rd",
    "chars": 6217,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_MetadataHeatmap.R\n\\name{do_MetadataHeat"
  },
  {
    "path": "man/do_NebulosaPlot.Rd",
    "chars": 7604,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_NebulosaPlot.R\n\\name{do_NebulosaPlot}\n\\"
  },
  {
    "path": "man/do_PackageReport.Rd",
    "chars": 1057,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/utils.R\n\\name{do_PackageReport}\n\\alias{do_"
  },
  {
    "path": "man/do_PathwayActivityHeatmap.Rd",
    "chars": 8683,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_PathwayActivityHeatmap.R\n\\name{do_Pathw"
  },
  {
    "path": "man/do_RankedEnrichmentHeatmap.Rd",
    "chars": 10934,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_RankedEnrichmentHeatmap.R\n\\name{do_Rank"
  },
  {
    "path": "man/do_RankedExpressionHeatmap.Rd",
    "chars": 10121,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_RankedExpressionHeatmap.R\n\\name{do_Rank"
  },
  {
    "path": "man/do_RidgePlot.Rd",
    "chars": 7931,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_RidgePlot.R\n\\name{do_RidgePlot}\n\\alias{"
  },
  {
    "path": "man/do_SCEnrichmentHeatmap.Rd",
    "chars": 10919,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_SCEnrichmentHeatmap.R\n\\name{do_SCEnrich"
  },
  {
    "path": "man/do_SCExpressionHeatmap.Rd",
    "chars": 9499,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_SCExpressionHeatmap.R\n\\name{do_SCExpres"
  },
  {
    "path": "man/do_StripPlot.Rd",
    "chars": 9987,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_StripPlot.R\n\\name{do_StripPlot}\n\\alias{"
  },
  {
    "path": "man/do_TFActivityHeatmap.Rd",
    "chars": 8670,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_TFActivityHeatmap.R\n\\name{do_TFActivity"
  },
  {
    "path": "man/do_TermEnrichmentPlot.Rd",
    "chars": 6322,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_TermEnrichmentPlot.R\n\\name{do_TermEnric"
  },
  {
    "path": "man/do_ViolinPlot.Rd",
    "chars": 7586,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_ViolinPlot.R\n\\name{do_ViolinPlot}\n\\alia"
  },
  {
    "path": "man/do_VolcanoPlot.Rd",
    "chars": 4512,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_VolcanoPlot.R\n\\name{do_VolcanoPlot}\n\\al"
  },
  {
    "path": "man/do_WafflePlot.Rd",
    "chars": 4945,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/do_WafflePlot.R\n\\name{do_WafflePlot}\n\\alia"
  },
  {
    "path": "man/doc_function.Rd",
    "chars": 19352,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/utils.R\n\\name{doc_function}\n\\alias{doc_fun"
  },
  {
    "path": "man/examples/examples_do_ActivityHeatmap.R",
    "chars": 1148,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_ActivityHeatmap\", passive = TRUE)\n"
  },
  {
    "path": "man/examples/examples_do_AlluvialPlot.R",
    "chars": 778,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_AlluvialPlot\", passive = TRUE)\n  m"
  },
  {
    "path": "man/examples/examples_do_BarPlot.R",
    "chars": 1412,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_BarPlot\", passive = TRUE)\n\n  if (i"
  },
  {
    "path": "man/examples/examples_do_BeeSwarmPlot.R",
    "chars": 1237,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_BeeSwarmPlot\", passive = TRUE)\n\n  "
  },
  {
    "path": "man/examples/examples_do_BoxPlot.R",
    "chars": 1603,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_BoxPlot\", passive = TRUE)\n\n  if (i"
  },
  {
    "path": "man/examples/examples_do_CNVHeatmap.R",
    "chars": 1293,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_CNVHeatmap\", passive = TRUE)\n\n  if"
  },
  {
    "path": "man/examples/examples_do_CellularStatesPlot.R",
    "chars": 2181,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_CellularStatesPlot\", passive = TRU"
  },
  {
    "path": "man/examples/examples_do_ChordDiagramPlot.R",
    "chars": 1065,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_ChordDiagramPlot\", passive = TRUE)"
  },
  {
    "path": "man/examples/examples_do_ColorBlindCheck.R",
    "chars": 505,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_ColorBlindCheck\", passive = TRUE)\n"
  },
  {
    "path": "man/examples/examples_do_ColorPalette.R",
    "chars": 2987,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_ColorPalette\", passive = TRUE)\n  \n"
  },
  {
    "path": "man/examples/examples_do_CorrelationHeatmap.R",
    "chars": 644,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_CorrelationHeatmap\", passive = TRU"
  },
  {
    "path": "man/examples/examples_do_DimPlot.R",
    "chars": 1244,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_DimPlot\", passive = TRUE)\n\n  if (i"
  },
  {
    "path": "man/examples/examples_do_DotPlot.R",
    "chars": 708,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_DotPlot\", passive = TRUE)\n\n  if (i"
  },
  {
    "path": "man/examples/examples_do_EnrichmentHeatmap.R",
    "chars": 981,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_EnrichmentHeatmap\", passive = TRUE"
  },
  {
    "path": "man/examples/examples_do_ExpressionHeatmap.R",
    "chars": 832,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_ExpressionHeatmap\", passive = TRUE"
  },
  {
    "path": "man/examples/examples_do_FeaturePlot.R",
    "chars": 1310,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_FeaturePlot\", passive = TRUE)\n\n  i"
  },
  {
    "path": "man/examples/examples_do_GroupwiseDEHeatmap.R",
    "chars": 841,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_GroupwiseDEHeatmap\", passive = TRU"
  },
  {
    "path": "man/examples/examples_do_LigandReceptorPlot.R",
    "chars": 560,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_LigandReceptorPlot\", passive = TRU"
  },
  {
    "path": "man/examples/examples_do_LoadingsHeatmap.R",
    "chars": 677,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_LoadingsHeatmap\", passive = TRUE)\n"
  },
  {
    "path": "man/examples/examples_do_MetadataHeatmap.R",
    "chars": 741,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_MetadataHeatmap\", passive = TRUE)\n"
  },
  {
    "path": "man/examples/examples_do_NebulosaPlot.R",
    "chars": 872,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_NebulosaPlot\", passive = TRUE)\n\n  "
  },
  {
    "path": "man/examples/examples_do_PathwayActivityHeatmap.R",
    "chars": 993,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_PathwayActivityHeatmap\", passive ="
  },
  {
    "path": "man/examples/examples_do_RankedEnrichmentHeatmap.R",
    "chars": 1481,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_RankedEnrichmentHeatmap\", passive "
  },
  {
    "path": "man/examples/examples_do_RankedExpressionHeatmap.R",
    "chars": 1299,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_RankedExpressionHeatmap\", passive "
  },
  {
    "path": "man/examples/examples_do_RidgePlot.R",
    "chars": 952,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_RidgePlot\", passive = TRUE)\n\n  if "
  },
  {
    "path": "man/examples/examples_do_SCEnrichmentHeatmap.R",
    "chars": 1097,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_SCEnrichmentHeatmap\", passive = TR"
  },
  {
    "path": "man/examples/examples_do_SCExpressionHeatmap.R",
    "chars": 767,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_SCExpressionHeatmap\", passive = TR"
  },
  {
    "path": "man/examples/examples_do_StripPlot.R",
    "chars": 979,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_StripPlot\", passive = TRUE)\n\n  if "
  },
  {
    "path": "man/examples/examples_do_TFActivityHeatmap.R",
    "chars": 982,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_TFActivityHeatmap\", passive = TRUE"
  },
  {
    "path": "man/examples/examples_do_TermEnrichmentPlot.R",
    "chars": 657,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_TermEnrichmentPlot\", passive = TRU"
  },
  {
    "path": "man/examples/examples_do_ViolinPlot.R",
    "chars": 876,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_ViolinPlot\", passive = TRUE)\n\n  if"
  },
  {
    "path": "man/examples/examples_do_VolcanoPlot.R",
    "chars": 806,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_VolcanoPlot\", passive = TRUE)\n\n  i"
  },
  {
    "path": "man/examples/examples_do_WafflePlot.R",
    "chars": 704,
    "preview": "\\donttest{\n  # Check Suggests.\n  value <- SCpubr:::check_suggests(function_name = \"do_WafflePlot\", passive = TRUE)\n  \n  "
  },
  {
    "path": "man/human_chr_locations.Rd",
    "chars": 530,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/data.R\n\\docType{data}\n\\name{human_chr_loca"
  },
  {
    "path": "man/named_list.Rd",
    "chars": 386,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/utils.R\n\\name{named_list}\n\\alias{named_lis"
  },
  {
    "path": "man/named_vector.Rd",
    "chars": 351,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/utils.R\n\\name{named_vector}\n\\alias{named_v"
  },
  {
    "path": "revdep/.gitignore",
    "chars": 79,
    "preview": "checks\nlibrary\nchecks.noindex\nlibrary.noindex\ncloud.noindex\ndata.sqlite\n*.html\n"
  },
  {
    "path": "revdep/email.yml",
    "chars": 99,
    "preview": "release_date: ???\nrel_release_date: ???\nmy_news_url: ???\nrelease_version: ???\nrelease_details: ???\n"
  },
  {
    "path": "tests/testthat/setup.R",
    "chars": 3480,
    "preview": "de_genes <- readRDS(system.file(\"extdata/de_genes_example.rds\", package = \"SCpubr\"))\n# nolint start\nif (requireNamespace"
  },
  {
    "path": "tests/testthat/test-do_ActivityHeatmap.R",
    "chars": 21297,
    "preview": "if (base::isFALSE(dep_check[[\"do_ActivityHeatmap\"]])){\n  \n  testthat::test_that(\"do_ActivityHeatmap: CRAN essentials\", {"
  },
  {
    "path": "tests/testthat/test-do_AlluvialPlot.R",
    "chars": 13288,
    "preview": "if (base::isFALSE(dep_check[[\"do_AlluvialPlot\"]])){\n\n  testthat::test_that(\"do_AlluvialPlot: CRAN essential tests\", {\n\n "
  },
  {
    "path": "tests/testthat/test-do_BarPlot.R",
    "chars": 16397,
    "preview": "if (base::isFALSE(dep_check[[\"do_BarPlot\"]])){\n\n  testthat::test_that(\"do_BarPlot: CRAN essential tests\", {\n    sample$o"
  },
  {
    "path": "tests/testthat/test-do_BeeSwarmPlot.R",
    "chars": 18126,
    "preview": "if (base::isFALSE(dep_check[[\"do_BeeSwarmPlot\"]])){\n\n  testthat::test_that(\"do_BeeSwarmPlot: CRAN essentials\", {\n    p <"
  },
  {
    "path": "tests/testthat/test-do_BoxPlot.R",
    "chars": 6399,
    "preview": "if (base::isFALSE(dep_check[[\"do_BoxPlot\"]])){\n\n  testthat::test_that(\"do_BoxPlot: CRAN essentials\", {\n    p <- SCpubr::"
  },
  {
    "path": "tests/testthat/test-do_CNVHeatmap.R",
    "chars": 9807,
    "preview": "if (base::isFALSE(dep_check[[\"do_CNVHeatmap\"]])){\n\n  testthat::test_that(\"do_BarPlot: CRAN essentials\", {\n    out <- SCp"
  },
  {
    "path": "tests/testthat/test-do_CellularStatesPlot.R",
    "chars": 48438,
    "preview": "if (base::isFALSE(dep_check[[\"do_CellularStatesPlot\"]])){\n\n  testthat::test_that(\"do_CellularStatesPlot: CRAN essentials"
  },
  {
    "path": "tests/testthat/test-do_ChordDiagramPlot.R",
    "chars": 12584,
    "preview": "if (base::isFALSE(dep_check[[\"do_ChordDiagramPlot\"]])){\n\n  testthat::test_that(\"do_ChordDiagramPlot: CRAN essentials\", {"
  },
  {
    "path": "tests/testthat/test-do_ColorBlindCheck.R",
    "chars": 422,
    "preview": "if (base::isFALSE(dep_check[[\"do_ColorBlindCheck\"]])){\n  testthat::test_that(\"do_ColorBlindCheck: PASS - color vectors\","
  },
  {
    "path": "tests/testthat/test-do_ColorPalette.R",
    "chars": 3673,
    "preview": "if (base::isFALSE(dep_check[[\"do_ColorPalette\"]])){\n  testthat::test_that(\"do_BarPlot: PASS - color vectors\", {\n\n    out"
  },
  {
    "path": "tests/testthat/test-do_CorrelationHeatmap.R",
    "chars": 5110,
    "preview": "if (base::isFALSE(dep_check[[\"do_CorrelationHeatmap\"]])){\n\n  testthat::test_that(\"do_CorrelationHeatmap: CRAN essentials"
  },
  {
    "path": "tests/testthat/test-do_DimPlot.R",
    "chars": 22426,
    "preview": "if (base::isFALSE(dep_check[[\"do_DimPlot\"]])){\n\n  testthat::test_that(\"do_DimPlot: CRAN essentials\", {\n    p <- SCpubr::"
  },
  {
    "path": "tests/testthat/test-do_DotPlot.R",
    "chars": 10107,
    "preview": "if (isFALSE(dep_check[[\"do_DotPlot\"]])){\n\n  testthat::test_that(\"do_DotPlot: CRAN essentials\", {\n\n    p <- SCpubr::do_Do"
  },
  {
    "path": "tests/testthat/test-do_EnrichmentHeatmap.R",
    "chars": 19311,
    "preview": "if (base::isFALSE(dep_check[[\"do_EnrichmentHeatmap\"]])){\n\n  testthat::test_that(\"do_EnrichmentHeatmap: CRAN essential\", "
  },
  {
    "path": "tests/testthat/test-do_ExpressionHeatmap.R",
    "chars": 10563,
    "preview": "if (base::isFALSE(dep_check[[\"do_ExpressionHeatmap\"]])){\n\n  testthat::test_that(\"do_ExpressionHeatmap: CRAN essential te"
  },
  {
    "path": "tests/testthat/test-do_FeaturePlot.R",
    "chars": 43971,
    "preview": "if (base::isFALSE(dep_check[[\"do_FeaturePlot\"]])){\n  testthat::test_that(\"do_FeaturePlot: CRAN essential\", {\n\n    p <- S"
  },
  {
    "path": "tests/testthat/test-do_GroupwiseDEHeatmap.R",
    "chars": 12399,
    "preview": "if(base::isFALSE(dep_check[[\"do_GroupwiseDEHeatmap\"]])){\n  testthat::test_that(\"do_GroupwiseDEHeatmap: CRAN essentials\","
  },
  {
    "path": "tests/testthat/test-do_LigandReceptorPlot.R",
    "chars": 32481,
    "preview": "if(base::isFALSE(dep_check[[\"do_LigandReceptorPlot\"]])){\n  testthat::test_that(\"do_LigandReceptorPlot: CRAN essentials\","
  },
  {
    "path": "tests/testthat/test-do_LoadingsHeatmap.R",
    "chars": 3499,
    "preview": "if (base::isFALSE(dep_check[[\"do_LoadingsHeatmap\"]])){\n  \n  testthat::test_that(\"do_LoadingsHeatmap: CRAN essentials\", {"
  },
  {
    "path": "tests/testthat/test-do_MetadataHeatmap.R",
    "chars": 1814,
    "preview": "if (base::isFALSE(dep_check[[\"do_MetadataHeatmap\"]])){\n  \n  testthat::test_that(\"do_MetadataHeatmap: CRAN essentials\", {"
  },
  {
    "path": "tests/testthat/test-do_NebulosaPlot.R",
    "chars": 12250,
    "preview": "if(base::isFALSE(dep_check[[\"do_NebulosaPlot\"]])){\n  testthat::test_that(\"do_NebulosaPlot: CRAN essentials\", {\n    p <- "
  },
  {
    "path": "tests/testthat/test-do_PathwayActivityHeatmap.R",
    "chars": 6857,
    "preview": "if (base::isFALSE(dep_check[[\"do_PathwayActivityHeatmap\"]])){\n\n  testthat::test_that(\"do_PathwayActivityHeatmap: CRAN es"
  },
  {
    "path": "tests/testthat/test-do_RankedEnrichmentHeatmap.R",
    "chars": 7642,
    "preview": "if (base::isFALSE(dep_check[[\"do_RankedEnrichmentHeatmap\"]])){\n  \n  testthat::test_that(\"do_RankedEnrichmentHeatmap: CRA"
  },
  {
    "path": "tests/testthat/test-do_RankedExpressionHeatmap.R",
    "chars": 6568,
    "preview": "if (base::isFALSE(dep_check[[\"do_RankedExpressionHeatmap\"]])){\n  \n  testthat::test_that(\"do_RankedExpressionHeatmap: CRA"
  },
  {
    "path": "tests/testthat/test-do_RidgePlot.R",
    "chars": 6697,
    "preview": "if(base::isFALSE(dep_check[[\"do_RidgePlot\"]])){\n\n  testthat::test_that(\"do_RidgePlot: CRAN essentials\", {\n\n    p <- SCpu"
  },
  {
    "path": "tests/testthat/test-do_SCEnrichmentHeatmap.R",
    "chars": 9132,
    "preview": "if (base::isFALSE(dep_check[[\"do_SCEnrichmentHeatmap\"]])){\n  \n  testthat::test_that(\"do_SCEnrichmentHeatmap: CRAN essent"
  },
  {
    "path": "tests/testthat/test-do_SCExpressionHeatmap.R",
    "chars": 5380,
    "preview": "if (base::isFALSE(dep_check[[\"do_SCExpressionHeatmap\"]])){\n  \n  testthat::test_that(\"do_SCExpressionHeatmap: CRAN essent"
  },
  {
    "path": "tests/testthat/test-do_StripPlot.R",
    "chars": 11651,
    "preview": "if(base::isFALSE(dep_check[[\"do_StripPlot\"]])){\n\n  testthat::test_that(\"do_StripPlot: CRAN essentials\", {\n\n    p <- SCpu"
  },
  {
    "path": "tests/testthat/test-do_TFActivityHeatmap.R",
    "chars": 5837,
    "preview": "if(base::isFALSE(dep_check[[\"do_TFActivityHeatmap\"]])){\n\n  testthat::test_that(\"do_TFActivityHeatmap: PASS - minimal inp"
  },
  {
    "path": "tests/testthat/test-do_TermEnrichmentPlot.R",
    "chars": 3156,
    "preview": "if(base::isFALSE(dep_check[[\"do_TermEnrichmentPlot\"]])){\n\n  testthat::test_that(\"do_TermEnrichmentPlot: CRAN essentials\""
  },
  {
    "path": "tests/testthat/test-do_ViolinPlot.R",
    "chars": 11039,
    "preview": "if(base::isFALSE(dep_check[[\"do_ViolinPlot\"]])){\n  testthat::test_that(\"do_ViolinPlot: CRAN essentials\", {\n\n    p <- SCp"
  },
  {
    "path": "tests/testthat/test-do_VolcanoPlot.R",
    "chars": 3918,
    "preview": "if(base::isFALSE(dep_check[[\"do_VolcanoPlot\"]])){\n  testthat::test_that(\"do_VolcanoPlot: CRAN essentials\", {\n\n    `%>%` "
  },
  {
    "path": "tests/testthat/test-do_WafflePlot.R",
    "chars": 1386,
    "preview": "if (base::isFALSE(dep_check[[\"do_WafflePlot\"]])){\n  \n  testthat::test_that(\"do_WafflePlot: CRAN essential tests\", {\n\n   "
  },
  {
    "path": "tests/testthat/test-utils.R",
    "chars": 34764,
    "preview": "if (base::isFALSE(dep_check[[\"utils\"]])){\n  # CHECK SUGGESTS\n  testthat::test_that(\"utils: check_suggests - FAIL - Wrong"
  },
  {
    "path": "tests/testthat.R",
    "chars": 83,
    "preview": "# nolint start\nlibrary(testthat)\nlibrary(SCpubr)\n# nolint end\ntest_check(\"SCpubr\")\n"
  },
  {
    "path": "vignettes/.gitignore",
    "chars": 11,
    "preview": "*.html\n*.R\n"
  },
  {
    "path": "vignettes/reference_manual.Rmd",
    "chars": 309,
    "preview": "---\ntitle: \"reference_manual\"\noutput: rmarkdown::html_vignette\nvignette: >\n  %\\VignetteIndexEntry{reference_manual}\n  %\\"
  }
]

// ... and 11 more files (download for full content)

About this extraction

This page contains the full source code of the enblacar/SCpubr GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 175 files (1.8 MB), approximately 420.9k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!