do_ChordDiagramPlot: Generate a Chord diagram.

View source: R/do_ChordDiagramPlot.R

do_ChordDiagramPlotR Documentation

Generate a Chord diagram.

Description

Generate a Chord diagram.

Usage

do_ChordDiagramPlot(
  sample = NULL,
  from = NULL,
  to = NULL,
  colors.from = NULL,
  colors.to = NULL,
  big.gap = 10,
  small.gap = 1,
  link.border.color = NA,
  link.border.width = 1,
  highlight_group = NULL,
  alpha.highlight = 25,
  link.sort = NULL,
  link.decreasing = TRUE,
  z_index = FALSE,
  self.link = 1,
  symmetric = FALSE,
  directional = 1,
  direction.type = c("diffHeight", "arrows"),
  link.arr.type = "big.arrow",
  scale = FALSE,
  alignment = "default",
  annotationTrack = c("grid", "axis"),
  padding_labels = 4,
  ...
)

Arguments

sample

Seurat | A Seurat object, generated by CreateSeuratObject.

from, to

character | Categorical metadata variable to be used as origin and end points of the interactions.

colors.from, colors.to

named_vector | Named vector of colors corresponding to the unique values of "from" and "to".

big.gap

numeric | Space between the groups in "from" and "to".

small.gap

numeric | Space within the groups.

link.border.color

character | Color for the border of the links. NA = no color.

link.border.width

numeric | Width of the border line of the links.

highlight_group

character | A value from from that will be used to highlight only the links coming from it.

alpha.highlight

numeric | A value between 00 (double digits) and 99 to depict the alpha of the highlighted links. No transparency needs "FF"

link.sort

pass to chordDiagramFromMatrix or chordDiagramFromDataFrame

link.decreasing

pass to chordDiagramFromMatrix or chordDiagramFromDataFrame

z_index

logical | Whether to bring the bigger links to the top.

self.link

numeric | Behavior of the links. One of:

  • 1: Prevents self linking.

  • 2: Allows self linking.

symmetric

pass to chordDiagramFromMatrix

directional

numeric | Set the direction of the links. One of:

  • 0: Non-directional data.

  • 1: Links go from "from" to "to".

  • -1: Links go from "to" to "from".

  • 2: Links go in both directions.

direction.type

character | How to display the directions. One of:

  • diffHeight: Sets a line at the origin of the group showing to how many groups and in which proportion this group is linked to.

  • arrows: Sets the connection as arrows.

  • both: Sets up both behaviors. Use as: c("diffHeight", "arrows").

link.arr.type

character | Sets the appearance of the arrows. One of:

  • triangle: Arrow with a triangle tip at the end displayed on top of the link.

  • big.arrow: The link itself ends in a triangle shape.

scale

logical | Whether to put all nodes the same width.

alignment

character | How to align the diagram. One of:

  • default: Allows circlize to set up the plot as it sees fit.

  • horizontal: Sets the break between "from" and "to" groups on the horizontal axis.

  • vertical: Sets the break between "from" and "to" groups on the vertical axis.

annotationTrack

pass to chordDiagramFromMatrix or chordDiagramFromDataFrame

padding_labels

numeric | Number of extra padding (white spaces) of the labels so that they do not overlap with the scales.

...

For internal use only.

Value

A circlize plot.

Examples


  # Check Suggests.
  value <- SCpubr:::check_suggests(function_name = "do_ChordDiagramPlot", passive = TRUE)

  if (isTRUE(value)){
    # Consult the full documentation in https://enblacar.github.io/SCpubr-book/

    # Define your Seurat object.
    sample <- readRDS(system.file("extdata/seurat_dataset_example.rds", package = "SCpubr"))

    # Basic chord diagram.
    sample$assignment <- ifelse(sample$seurat_clusters %in% c("0", "4", "7"), "A", "B")
    sample$assignment[sample$seurat_clusters %in% c("1", "2")] <- "C"
    sample$assignment[sample$seurat_clusters %in% c("10", "5")] <- "D"
    sample$assignment[sample$seurat_clusters %in% c("8", "9")] <- "E"

    p <- SCpubr::do_ChordDiagramPlot(sample = sample,
                                     from = "seurat_clusters",
                                     to = "assignment")

    p

  } else if (base::isFALSE(value)){
    message("This function can not be used without its suggested packages.")
    message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
  }



SCpubr documentation built on Oct. 11, 2023, 5:15 p.m.