Skip to content

Commit

Permalink
Add per_time suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
cafferychen777 committed Sep 12, 2024
1 parent 6286763 commit 8ea9c67
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ alpha_volatility_test_results <- generate_alpha_volatility_test_long(

After discussing the functions `generate_alpha_trend_test_long` and `generate_alpha_volatility_test_long`, let's explore another important aspect of analyzing longitudinal alpha diversity data in the context of Type 2 Diabetes (T2D) dataset.

In addition to the trend and volatility tests, MicrobiomeStat provides the capability to perform detailed alpha diversity tests at each time point in a longitudinal study. This is achieved using the `generate_alpha_test_long` function. This function allows for a comprehensive examination of alpha diversity measures such as Shannon, Simpson, Observed Species, Chao1, ACE, and Pielou's Evenness across different time points in the dataset.
In addition to the trend and volatility tests, MicrobiomeStat provides the capability to perform detailed alpha diversity tests at each time point in a longitudinal study. This is achieved using the `` function. This function allows for a comprehensive examination of alpha diversity measures such as Shannon, Simpson, Observed Species, Chao1, ACE, and Pielou's Evenness across different time points in the dataset.

To perform the longitudinal alpha diversity test for the T2D dataset, we apply the `generate_alpha_test_long` function. This function requires specifying various parameters including alpha diversity measures, time variable, levels for time points, group variable, and any additional variables for adjustment. Here's an example:
To perform the longitudinal alpha diversity test for the T2D dataset, we apply the `generate_alpha_per_time_test_long` function. This function requires specifying various parameters including alpha diversity measures, time variable, levels for time points, group variable, and any additional variables for adjustment. Here's an example:

```r
alpha_test_results_T2D <- generate_alpha_test_long(
alpha_test_results_T2D <- generate_alpha_per_time_test_long(
data.obj = subset_T2D.obj,
alpha.name = c("shannon", "simpson", "observed_species", "chao1", "ace", "pielou"),
time.var = "visit_number",
Expand Down Expand Up @@ -116,10 +116,10 @@ dot_plots_T2D <- generate_alpha_dotplot_long(

In the dot plots generated by `generate_alpha_dotplot_long`, you'll notice that some dots are marked with an asterisk (\*). These asterisks signify statistical significance.

Further enhancing our analysis, we introduce the `generate_alpha_change_test_long` function. This function is specifically designed to assess the change in alpha diversity for each subject at different time points relative to a baseline level (`t0.level`). It performs statistical tests to evaluate the significance of changes in alpha diversity, using measures like "log fold change" to quantify these alterations. This approach is particularly insightful in longitudinal studies where the focus is on understanding how individual subjects' microbial communities evolve over time.
Further enhancing our analysis, we introduce the `generate_alpha_change_per_time_test_long` function. This function is specifically designed to assess the change in alpha diversity for each subject at different time points relative to a baseline level (`t0.level`). It performs statistical tests to evaluate the significance of changes in alpha diversity, using measures like "log fold change" to quantify these alterations. This approach is particularly insightful in longitudinal studies where the focus is on understanding how individual subjects' microbial communities evolve over time.

```r
alpha_test_results_T2D <- generate_alpha_change_test_long(
alpha_test_results_T2D <- generate_alpha_change_per_time_test_long(
data.obj = subset_T2D.obj,
alpha.name = c("shannon", "simpson", "observed_species", "chao1", "ace", "pielou"),
time.var = "visit_number",
Expand All @@ -132,7 +132,7 @@ alpha_test_results_T2D <- generate_alpha_change_test_long(
)
```

To visualize the results from `generate_alpha_change_test_long`, we use the `generate_alpha_dotplot_long` function. This function creates dot plots for the alpha diversity measures, providing an intuitive understanding of the changes and differences across time points and groups. The plots help in visually interpreting the statistical significance and trends in the data. Here's how you can generate these plots for the T2D dataset:
To visualize the results from `generate_alpha_change_per_time_test_long`, we use the `generate_alpha_dotplot_long` function. This function creates dot plots for the alpha diversity measures, providing an intuitive understanding of the changes and differences across time points and groups. The plots help in visually interpreting the statistical significance and trends in the data. Here's how you can generate these plots for the T2D dataset:

```r
dot_plots_T2D <- generate_alpha_dotplot_long(
Expand All @@ -151,7 +151,7 @@ dot_plots_T2D <- generate_alpha_dotplot_long(

<figure><img src="../.gitbook/assets/Screenshot 2024-01-18 at 16.55.23.png" alt=""><figcaption></figcaption></figure>

These functions, `generate_alpha_test_long`, `generate_alpha_change_test_long`, and `generate_alpha_dotplot_long`, complement the earlier discussed functions by providing a more granular view of alpha diversity over time. They are especially useful in studies with multiple time points like the T2D dataset, offering a comprehensive perspective on the dynamics of microbial diversity.
These functions, `generate_alpha_per_time_test_long`, `generate_alpha_change_per_time_test_long`, and `generate_alpha_dotplot_long`, complement the earlier discussed functions by providing a more granular view of alpha diversity over time. They are especially useful in studies with multiple time points like the T2D dataset, offering a comprehensive perspective on the dynamics of microbial diversity.

Before we proceed with the visualization, it's crucial to understand the `time.var`, `t0.level`, and `ts.levels` parameters used in the functions `generate_alpha_spaghettiplot_long` and `generate_alpha_boxplot_long`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ volcano_plots_T2D <- generate_taxa_volcano_single(

<figure><img src="../.gitbook/assets/Screenshot 2024-01-18 at 18.07.50.png" alt=""><figcaption></figcaption></figure>

Building on this, we also use the `generate_taxa_test_long` function to analyze the microbiome data at each individual time point. This function performs a subset analysis on the dataset, followed by a statistical test using the linda method for each time point. It enables a detailed investigation of taxa changes over time, considering various factors such as subject characteristics and sample sites.
Building on this, we also use the `generate_taxa_per_time_test_long` function to analyze the microbiome data at each individual time point. This function performs a subset analysis on the dataset, followed by a statistical test using the linda method for each time point. It enables a detailed investigation of taxa changes over time, considering various factors such as subject characteristics and sample sites.

```r
result2 <- generate_taxa_test_long(
result2 <- generate_taxa_per_time_test_long(
data.obj = subset_T2D.obj,
subject.var = "subject_id",
time.var = "visit_number",
Expand All @@ -144,10 +144,10 @@ result2 <- generate_taxa_test_long(
)
```

To effectively visualize these results, we employ the `generate_taxa_dotplot_long` function. This function creates dot plots that provide a clear and intuitive visualization of the taxa changes at different time points, facilitating an understanding of the temporal dynamics within the dataset.
To effectively visualize these results, we employ the `generate_taxa_per_time_dotplot_long` function. This function creates dot plots that provide a clear and intuitive visualization of the taxa changes at different time points, facilitating an understanding of the temporal dynamics within the dataset.

```r
dotplot_T2D <- generate_taxa_dotplot_long(
dotplot_T2D <- generate_taxa_per_time_dotplot_long(
data.obj = subset_T2D.obj,
test.list = result2,
group.var = "subject_race",
Expand All @@ -158,7 +158,7 @@ dotplot_T2D <- generate_taxa_dotplot_long(

<figure><img src="../.gitbook/assets/Screenshot 2024-01-18 at 17.38.01.png" alt=""><figcaption></figcaption></figure>

These methods, including both the `generate_taxa_test_long` and `generate_taxa_dotplot_long`, enhance our ability to scrutinize and understand the intricate patterns and variations in taxa abundance throughout the course of the Type 2 Diabetes study, thereby enriching our analysis and insights.
These methods, including both the `generate_taxa_per_time_test_long` and `generate_taxa_per_time_dotplot_long`, enhance our ability to scrutinize and understand the intricate patterns and variations in taxa abundance throughout the course of the Type 2 Diabetes study, thereby enriching our analysis and insights.

Further advancing our analysis, we introduce the `generate_taxa_change_test_long` function. This function is designed to analyze the change in taxa abundance relative to a baseline time point (`t0.level`). It provides insights into the changes in microbiome composition from the baseline to subsequent time points, considering the diversity at different taxonomic levels such as Genus and Family.

Expand All @@ -178,10 +178,10 @@ result <- generate_taxa_change_test_long(
)
```

The results from this function can be visualized using `generate_taxa_dotplot_long`, which provides a comprehensive view of the taxa changes from the baseline across different time points. This visualization aids in identifying significant shifts in the microbiome composition over the course of the study.
The results from this function can be visualized using `generate_taxa_per_time_dotplot_long`, which provides a comprehensive view of the taxa changes from the baseline across different time points. This visualization aids in identifying significant shifts in the microbiome composition over the course of the study.

```r
dotplot_T2D <- generate_taxa_dotplot_long(
dotplot_T2D <- generate_taxa_per_time_dotplot_long(
data.obj = subset_T2D.obj,
test.list = result,
t0.level = unique(subset_T2D.obj$meta.dat$visit_number)[1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ generate_beta_volatility_test_long(

<table><thead><tr><th>Term</th><th width="140">Estimate</th><th>Std.Error</th><th>Statistic</th><th>P.Value</th></tr></thead><tbody><tr><td>(Intercept)</td><td>0.956</td><td>0.161</td><td>5.93</td><td>0.000000164</td></tr><tr><td>subject_racecaucasian</td><td>-0.104</td><td>0.182</td><td>-0.571</td><td>0.570</td></tr><tr><td>subject_racehispanic_or_latino</td><td>-0.502</td><td>0.372</td><td>-1.35</td><td>0.183</td></tr><tr><td>subject_race</td><td>NA</td><td>NA</td><td>0.909</td><td>0.408</td></tr><tr><td>Residuals</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td></tr></tbody></table>

In addition to trend and volatility analysis, we introduce the `generate_beta_change_test_long` function. This function evaluates the change in beta diversity for each subject at different time points relative to a baseline level (`t0.level`). It's designed to assess the statistical significance of these changes over time, adding depth to our understanding of beta diversity dynamics in longitudinal studies.
In addition to trend and volatility analysis, we introduce the `generate_beta_change_per_time_test_long` function. This function evaluates the change in beta diversity for each subject at different time points relative to a baseline level (`t0.level`). It's designed to assess the statistical significance of these changes over time, adding depth to our understanding of beta diversity dynamics in longitudinal studies.

```r
result1 <- generate_beta_change_test_long(
result1 <- generate_beta_change_per_time_test_long(
data.obj = subset_T2D.obj,
dist.obj = NULL,
time.var = "visit_number_num",
Expand All @@ -87,10 +87,10 @@ result1 <- generate_beta_change_test_long(
)
```

To visualize the results of the `generate_beta_change_test_long` analysis, the `generate_beta_dotplot_long` function is used. This function produces dot plots that illustrate the changes in beta diversity across different time points and groups. Such visualizations are instrumental in highlighting significant trends and variations in the dataset.
To visualize the results of the `generate_beta_change_per_time_test_long` analysis, the `generate_beta_per_time_dotplot_long` function is used. This function produces dot plots that illustrate the changes in beta diversity across different time points and groups. Such visualizations are instrumental in highlighting significant trends and variations in the dataset.

```r
dotplot_T2D <- generate_beta_dotplot_long(
dotplot_T2D <- generate_beta_per_time_dotplot_long(
data.obj = subset_T2D.obj,
test.list = result1,
group.var = "subject_race",
Expand Down

0 comments on commit 8ea9c67

Please sign in to comment.