iobr_cor_plot: Integrative Correlation Between Phenotype and Features

View source: R/iobr_cor_plot.R

iobr_cor_plotR Documentation

Integrative Correlation Between Phenotype and Features

Description

Performs integrative correlation analysis between phenotype data and feature data, supporting both continuous and categorical phenotypes. This function filters features based on adjusted p-value cutoffs and can visualize results in various plot formats including box plots, heatmaps, and correlation plots.

Usage

iobr_cor_plot(
  pdata_group,
  id1 = "ID",
  feature_data,
  id2 = "ID",
  target = NULL,
  group = "group3",
  is_target_continuous = TRUE,
  padj_cutoff = 1,
  index = 1,
  category = "signature",
  signature_group = sig_group,
  ProjectID = "TCGA",
  palette_box = "nrc",
  cols_box = NULL,
  palette_corplot = "pheatmap",
  palette_heatmap = 2,
  feature_limit = 26,
  character_limit = 60,
  show_heatmap_col_name = FALSE,
  show_col = FALSE,
  show_plot = FALSE,
  path = NULL,
  discrete_x = 20,
  discrete_width = 20,
  show_palettes = FALSE,
  fig.type = "pdf"
)

Arguments

pdata_group

A data frame containing phenotype data including an identifier column.

id1

Column name in 'pdata_group' serving as the identifier.

feature_data

A data frame containing feature data corresponding to the identifiers.

id2

Column name in 'feature_data' serving as the identifier.

target

Optional; the column name for the target variable if continuous. Default is NULL.

group

The grouping variable name used for categorical analysis, default is "group3".

is_target_continuous

Logical; specifies if the target variable is continuous, affecting grouping strategy.

padj_cutoff

Cutoff for adjusted p-values to filter features, default is 1.

index

Numeric index used to order file names for output.

category

Specifies if the data pertains to 'signature' or 'gene'.

signature_group

Grouping variable for signatures; differentiates between 'sig_group' for signature grouping or 'signature_collection'/'signature_tme' for gene grouping.

ProjectID

Identifier for the project, used in file naming.

palette_box

Color palette for box plots.

cols_box

Optional; specific color settings for the box, default is NULL.

palette_corplot

Color palette for correlation plots.

palette_heatmap

Index for heatmap color palette.

feature_limit

Maximum number of features to consider, default is 26.

character_limit

Maximum number of characters for variable labels, default is 60.

show_heatmap_col_name

Logical; if TRUE, shows column names on the heatmap.

show_col

Logical; if TRUE, shows color codes for palettes.

show_plot

Logical; if TRUE, prints plots to the display.

path

Optional; path to save output files. Default is NULL.

discrete_x

Numeric threshold for character length beyond which labels will be discretized.

discrete_width

Numeric; specifies the width for label wrapping in plots.

show_palettes

Logical; if TRUE, displays color palettes used.

fig.type

Format for saving figures, default is 'pdf', can be changed to 'png'.

Value

Depending on the configuration, this function returns various plots such as box plots, heatmaps, and correlation plots, and may also return a dataframe containing statistical analysis results.

Author(s)

Dongqiang Zeng

Examples

# Assuming 'pdata_group' and 'feature_data' are predefined:
pdata_group <- data.frame(ID = 1:100, phenotype = sample(c("Type1", "Type2"), 100, replace = TRUE))
feature_data <- data.frame(ID = 1:100, Feature1 = rnorm(100), Feature2 = rnorm(100))
results <- iobr_cor_plot(pdata_group = pdata_group, feature_data = feature_data,
                         id1 = "ID", id2 = "ID", target = "Feature1", is_target_continuous = TRUE,
                         show_plot = TRUE, path = "path/to/save/results")
print(results)

IOBR/IOBR documentation built on Sept. 9, 2024, 8:36 p.m.