This function identifies and visualizes OTUs/ASVs that exhibit opposing temporal trends based on a correlation threshold. It computes the correlation matrix of predicted OTU/ASV time-series data, selects those OTUs with correlations below a specified threshold, and generates smoothed temporal profile plots. Optionally, raw data points are overlaid and taxonomic annotations are added if provided.
Data.opp.cor.vis(
predicted_data,
pre_processed_data,
Design_data,
ng_cor_thres,
Taxa = NULL,
plot_dots = TRUE,
figure_x_scale = 5,
title_size = 10,
axis_title_size = 10,
axis_text_y_size = 8,
axis_text_x_size = 8,
legend_title_size = 10,
legend_text_size = 8,
dots_size = 0.6
)An object of class DataOppCorVis which contains the list of each targeted microbial feature.
The output data frame from the Pred.data).
The transformed data output from the Data.trans function. A
pre-processed OTU data frame with sample IDs as row names and OTU IDs as column names.
The output data from the Design).
A numeric value specifying the correlation threshold below which OTUs are considered to exhibit opposing trends.
A data frame providing taxonomic annotations for microbial species.
Logical; if TRUE, raw data points are overlaid on the temporal curves (default: TRUE).
A numeric value specifying the interval for x-axis breaks in the figures (default: 5).
A numeric value specifying the font size for the plot title (default: 10).
A numeric value specifying the font size for the axis titles (default: 8).
A numeric value specifying the font size for the y-axis text (default: 5).
A numeric value specifying the font size for the x-axis text (default: 5).
A numeric value specifying the font size for legend titles (default: 5).
A numeric value specifying the font size for legend text (default: 5).
A numeric value specifying the size of the overlaid raw data points (default: 0.7).
Shijia Li
For each group in the predicted_data list, the function first removes the time column and computes a correlation matrix
from the predicted OTU data. It then extracts, for each OTU, the subset of OTUs that show a correlation lower than the specified threshold
(\(\text{ng\_cor\_thres}\)). If an OTU does not have any opposing trends (i.e., all correlations exceed the threshold), it is skipped.
For those OTUs meeting the criteria, the function restructures the data into long format and plots the temporal profiles using
geom_smooth to display the primary trend (solid line) and opposing trends (dashed lines). If plot_dots is TRUE,
the raw data points extracted from the design data are also overlaid. When taxonomic annotations are provided via Taxa,
OTU labels are augmented with species information. The x-axis is scaled according to figure_x_scale, and plot aesthetics
(titles, axis text, legends, and dot sizes) can be customized using the respective parameters.