Diff of /man/circos_fruits.Rd [000000] .. [0f2269]

Switch to unified view

a b/man/circos_fruits.Rd
1
% Generated by roxygen2: do not edit by hand
2
% Please edit documentation in R/CircosFruits.R
3
\name{circos_fruits}
4
\alias{circos_fruits}
5
\title{Add multiple layers to a `ggtree` plot for visualizing gene expression and enrichment data}
6
\usage{
7
circos_fruits(
8
  p,
9
  long_format_HeatdataDeseq,
10
  ssgsea_kegg_HeatdataDeseq,
11
  gsva_kegg_HeatdataDeseq,
12
  gene_colors
13
)
14
}
15
\arguments{
16
\item{p}{A `ggtree` plot object to which the data and layers will be added.}
17
18
\item{long_format_HeatdataDeseq}{A data frame containing gene expression data with columns for `Samples`, `Genes`, and `Values`.}
19
20
\item{ssgsea_kegg_HeatdataDeseq}{A data frame containing SSGSEA analysis results with columns for `Samples`, `Genes`, and `Values`.}
21
22
\item{gsva_kegg_HeatdataDeseq}{A data frame containing GSVA analysis results with columns for `Samples`, `Genes`, and `Values`.}
23
24
\item{gene_colors}{A named vector of colors for genes, used for coloring tiles in different layers.}
25
}
26
\value{
27
A `ggtree` plot object with multiple layers added for comprehensive visualization.
28
}
29
\description{
30
This function sequentially adds multiple layers to a `ggtree` plot, including gene expression data, boxplots for statistical
31
summaries, and additional tile layers for pathway enrichment scores from SSGSEA and GSVA analyses. It utilizes separate
32
functions for adding each type of layer and allows for the specification of gene colors as well as adjustments in aesthetics
33
for each layer. The function is designed to work with specific data structures and assumes all functions for adding layers
34
are defined and available.
35
}
36
\examples{
37
\donttest{
38
# Check and load required packages
39
if (requireNamespace("ggtreeExtra", quietly = TRUE) &&
40
 requireNamespace("ggplot2", quietly = TRUE)) {
41
  library(ggtreeExtra)
42
  library(ggplot2)
43
44
  # Example data for gene expression, SSGSEA, and GSVA
45
  file_path <- system.file("extdata", "p_tree_test.rds", package = "TransProR")
46
  p <- readRDS(file_path)
47
48
  # Create gene expression data frame (long_format_HeatdataDeseq)
49
  long_format_HeatdataDeseq <- data.frame(
50
    Sample = rep(c("Species_A", "Species_B", "Species_C", "Species_D"), each = 5),
51
    Genes = rep(paste0("Gene", 1:5), times = 4),
52
    Value = runif(20, min = 0, max = 1)  # Randomly generate expression values between 0 and 1
53
  )
54
55
  # Create SSGSEA analysis results data frame (ssgsea_kegg_HeatdataDeseq)
56
  ssgsea_kegg_HeatdataDeseq <- data.frame(
57
    Sample = rep(c("Species_A", "Species_B", "Species_C", "Species_D"), each = 3),
58
    Genes = rep(c("Pathway1", "Pathway2", "Pathway3"), times = 4),
59
    Value = runif(12, min = 0, max = 1)  # Randomly generate enrichment scores between 0 and 1
60
  )
61
62
  # Create GSVA analysis results data frame (gsva_kegg_HeatdataDeseq)
63
  gsva_kegg_HeatdataDeseq <- data.frame(
64
    Sample = rep(c("Species_A", "Species_B", "Species_C", "Species_D"), each = 4),
65
    Genes = rep(c("PathwayA", "PathwayB", "PathwayC", "PathwayD"), times = 4),
66
    Value = runif(16, min = 0, max = 1)  # Randomly generate enrichment scores between 0 and 1
67
  )
68
69
  # Define gene and pathway colors (named vector), including all genes and pathways
70
  gene_colors <- c(
71
    # Genes for gene expression
72
    Gene1 = "#491588",
73
    Gene2 = "#301b8d",
74
    Gene3 = "#1a237a",
75
    Gene4 = "#11479c",
76
    Gene5 = "#0a5797",
77
    # Pathways for SSGSEA
78
    Pathway1 = "#0b5f63",
79
    Pathway2 = "#074d41",
80
    Pathway3 = "#1f5e27",
81
    # Pathways for GSVA
82
    PathwayA = "#366928",
83
    PathwayB = "#827729",
84
    PathwayC = "#a1d99b",
85
    PathwayD = "#c7e9c0"
86
  )
87
88
  # Call circos_fruits function to add multiple layers
89
  final_plot <- circos_fruits(
90
    p,
91
    long_format_HeatdataDeseq,
92
    ssgsea_kegg_HeatdataDeseq,
93
    gsva_kegg_HeatdataDeseq,
94
    gene_colors
95
  )
96
} else {
97
  message("Required packages 'ggtreeExtra' and 'ggplot2' are not installed.")
98
}
99
}
100
101
}