a b/man/extract_positive_pathways.Rd
1
% Generated by roxygen2: do not edit by hand
2
% Please edit documentation in R/EnrichmentSpiralize.R
3
\name{extract_positive_pathways}
4
\alias{extract_positive_pathways}
5
\title{Extract Positive Pathways from SSGSEA Results and Select Random Samples}
6
\usage{
7
extract_positive_pathways(ssgsea_kegg, max_paths_per_sample = 5)
8
}
9
\arguments{
10
\item{ssgsea_kegg}{A matrix or data frame with pathways as rows and samples as columns.}
11
12
\item{max_paths_per_sample}{Integer, maximum number of pathways to select per sample.}
13
}
14
\value{
15
A data frame with selected pathways, samples, and their corresponding values.
16
}
17
\description{
18
This function processes the results of SSGSEA, specifically focusing on KEGG pathways.
19
It extracts pathways with positive values from each sample and randomly selects a subset of them.
20
}
21
\examples{
22
# Example: Generating input data for the extract_positive_pathways function
23
24
# Define example pathways
25
pathways <- c("Pathway_1", "Pathway_2", "Pathway_3", "Pathway_4", "Pathway_5",
26
              "Pathway_6", "Pathway_7", "Pathway_8", "Pathway_9", "Pathway_10")
27
28
# Define example samples
29
samples <- c("Sample_A", "Sample_B", "Sample_C")
30
31
# Generate random SSGSEA KEGG scores including both positive and negative values
32
set.seed(456)  # For reproducibility
33
ssgsea_scores <- matrix(rnorm(length(pathways) * length(samples), mean = 0, sd = 1),
34
                        nrow = length(pathways), ncol = length(samples),
35
                        dimnames = list(pathways, samples))
36
37
# Convert to a data frame
38
ssgsea_kegg <- as.data.frame(ssgsea_scores)
39
40
# Use the extract_positive_pathways function to extract up to 3 positive pathways per sample
41
selected_positive_pathways <- extract_positive_pathways(ssgsea_kegg, max_paths_per_sample = 3)
42
43
}