| Title: | Gene Set Circular Analysis for Rhythms Ascertainment in Bioprocesses |
|---|---|
| Description: | GeneSCARAB includes a range of features designed to enable a robust and comprehensive analysis of the circular distributions of biomolecules (genes, proteins, metabolites, ...) associated with bioprocesses in any species. It is specifically designed for circadian omics studies and facilitates data organization, statistical analysis, and the visualization of results. It works with the output of standard rhythm detection software, such as CircaCompare, MetaCycle or RAIN. |
| Authors: | Marcos Ramos-González [aut, cre] (ORCID: <https://orcid.org/0000-0001-9130-586X>), Emma Serrano-Pérez [ctb] (ORCID: <https://orcid.org/0000-0001-9350-7342>), Víctor Ramos-González [ctb] (ORCID: <https://orcid.org/0000-0002-5452-9394>), Mercedes García-González [ctb] (ORCID: <https://orcid.org/0000-0003-0375-8493>), Francisco J. Romero-Campero [ctb] (ORCID: <https://orcid.org/0000-0001-9834-030X>) |
| Maintainer: | Marcos Ramos-González <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 0.99.3 |
| Built: | 2026-10-10 17:28:43 UTC |
| Source: | https://github.com/BiocStaging/GeneSCARAB |
Function that takes a vector of gene phases (continuous measurements or parametric estimates) and returns statistical measures of their circular distribution and their deviations from a circular uniform distribution based on the Rayleigh, Kuiper, Hermans-Rasson and Rao tests
.create_circular_table( circa_vector, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05 ).create_circular_table( circa_vector, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05 )
circa_vector |
Phases vector in hours |
hr.on.large.sets.th |
Threshold indicating the maximum size of a set to perform HR test on |
iter.hr |
Number of iterations for HR test |
force.hr.th |
Significance level to execute HR test if Rayleigh and Kuiper p-values are higher |
rao.on.large.sets.th |
Threshold indicating the maximum size of a set to perform Rao test on |
iter.rao |
Number of iterations for Rao test |
force.rao.th |
Significance level to execute Rao test if Rayleigh, Kuiper and HR p-values are higher |
A table indicating number of phases used for computation (n); mean, rho, variance, first, second and third quantiles of the circular distribution in hours; and p-values for each of the four tests
Function that takes a vector of gene phases (discrete measurements or non-parametric estimates) and returns statistical measures of their circular distribution and their deviations from a circular uniform distribution based on Rayleigh and adapted versions of Kuiper, Hermans-Rasson and Rao tests.
.create_circular_table_grouped( circa_vector, n_bins, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05, kuiper.on.large.sets.th = 400, iter.kuiper = 999, force.kuiper.th = 0.05 ).create_circular_table_grouped( circa_vector, n_bins, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05, kuiper.on.large.sets.th = 400, iter.kuiper = 999, force.kuiper.th = 0.05 )
circa_vector |
Discrete phases vector in hours |
n_bins |
Number of bins |
hr.on.large.sets.th |
Threshold indicating the maximum size of a set to perform HR test on |
iter.hr |
Number of iterations for HR test |
force.hr.th |
Significance level to execute HR test if Rayleigh and Kuiper p-values are higher |
rao.on.large.sets.th |
Threshold indicating the maximum size of a set to perform Rao test on |
iter.rao |
Number of iterations for Rao test |
force.rao.th |
Significance level to execute Rao test if Rayleigh, Kuiper and HR p-values are higher |
kuiper.on.large.sets.th |
Threshold indicating the maximum size of a set to perform Kuiper test on |
iter.kuiper |
Number of iterations for Kuiper test |
force.kuiper.th |
Significance level to execute Kuiper test if Rayleigh p-value is higher |
A data.frame indicating number of phases used for computation (n); mean, rho, variance, first, second and third quartiles of the circular distribution in hours; and p-values for each of the four tests
Function to extract all ancestors of given GO terms
.get_ancestor_for_gene_lists(go_vector).get_ancestor_for_gene_lists(go_vector)
go_vector |
GO terms vector to be included in the analysis, along with their ancestors. "all" takes the complete set from the annotation package |
A vector containing ancestors of GO terms
Function to create axis and initialize plot
.helper_init_plot().helper_init_plot()
Axis
Helper function that calculates the p-value of an adaptation of the Hermans-Rasson test for grouped data (discrete phases) as implemented in the article "Grouped circular data in biology: advice for effectively implementing statistical procedures" https://doi.org/10.1007/s00265-020-02881-6.
.HermansRasson2PGroupedRad(sample, m, iter = 9999).HermansRasson2PGroupedRad(sample, m, iter = 9999)
sample |
Data points in radians |
m |
Number of bins |
iter |
Number of iterations |
The p-value for the test
A helper function that calculates the critical value for the HR test, as implemented in the article "Grouped circular data in biology: advice for effectively implementing statistical procedures" https://doi.org/10.1007/s00265-020-02881-6.
.HermansRasson2T(sample).HermansRasson2T(sample)
sample |
Data points in radians |
The critical value for the test
Helper function checking correctness of input for complete_circular_table and complete_circular_table_grouped
.input_complete_circular_table(phase.list).input_complete_circular_table(phase.list)
phase.list |
Phases list in the same format as the output of gene_list_to_phases |
An error if input is not adequate
Helper function checking correctness of input for .create_circular_table and .create_circular_table_grouped
.input_create_circular_table(circa_vector).input_create_circular_table(circa_vector)
circa_vector |
Phases vector in hours |
An error if input is not adequate
Helper function checking correctness of input for create_gene_list_go and generating a data.frame with all the GO terms per gene
.input_create_gene_list_go(go_vector, org.package, go_column, id_column).input_create_gene_list_go(go_vector, org.package, go_column, id_column)
go_vector |
GO terms vector to be included in the analysis, along with their ancestors. "all" takes the complete set from the annotation package |
org.package |
OrgDb object from species annotation package (*.db) |
go_column |
GO term column name in the annotation package |
id_column |
Gene ID column name in the annotation package |
A data.frame showing GO terms per gene as appear in the annotation package
Helper function checking correctness of input for create_gene_list_kegg and generating a data.frame with all the KOs per gene
.input_create_gene_list_kegg( ko_vector = c("all"), org.package, ko_column, id_column, ko_prefix = "map", species = "all" ).input_create_gene_list_kegg( ko_vector = c("all"), org.package, ko_column, id_column, ko_prefix = "map", species = "all" )
ko_vector |
KO vector to be included in the analysis, along with their pathways ancestors. "all" takes the complete set from the annotation package |
org.package |
OrgDb object from species annotation package (*.db) |
ko_column |
KO column name in the annotation package |
id_column |
Gene ID column name in the annotation package |
ko_prefix |
Prefix used to denote KEGG pathways, either "map" or "ko", depending on package version |
species |
Species group to filter final pathways ("all" for no filtering), either "bacteria", "archaea", "animals", "plants", "fungi" or "protists" |
A data.frame showing KO terms per gene as appear in the annotation package
Helper function checking correctness of input for gene_contribution_to_set and returning a clean phase list
.input_gene_contribution(circa_result, phase_list).input_gene_contribution(circa_result, phase_list)
circa_result |
Table with circular distribution results, as the output from complete_circular_table or complete_circular_table_grouped |
phase_list |
Phases list in the same format as the output of gene_list_to_phases, containing the row names of circa_result as names of each element |
A phase list containing only elements that appear in circa_result rows
Helper function that calculates the p-value of an adaptation of the Kuiper test for grouped data (discrete phases) as implemented in the article "Grouped circular data in biology: advice for effectively implementing statistical procedures" https://doi.org/10.1007/s00265-020-02881-6.
.KuiperPGroupedRad(sample, m, iter = 9999).KuiperPGroupedRad(sample, m, iter = 9999)
sample |
Data points in radians |
m |
Number of bins |
iter |
Number of iterations |
The p-value for the test
Function to create tracks for dotplot
.legend_builder(phases.list, my_color).legend_builder(phases.list, my_color)
phases.list |
A named phase tables list in the same format as the output of gene_list_to_phases |
my_color |
Color vector to use |
Legend of the plots
Function to create tracks for boxplot
.legend_builder_boxplot(quan.table, my_color).legend_builder_boxplot(quan.table, my_color)
quan.table |
A circular results table with sem info |
my_color |
Color vector to use |
Legend of the plots
Function to determine the extract the Rayleigh p-value in the presence of f-fold symmetry (1, 2 or 3)
.multimodal_modes_test(phase_table).multimodal_modes_test(phase_table)
phase_table |
A phase table, as the individual elements of the list derived from gene_list_to_phases |
A vector containing the p-values for 1,2 and 3 f-fold symmetry
Function to extract KEGG pathways associated to a vector of KO terms and create a list containing this information
.pathways_from_kos(ko_vector, ko_prefix).pathways_from_kos(ko_vector, ko_prefix)
ko_vector |
KO vector to extract pathways |
ko_prefix |
Prefix used to denote KEGG pathways, either "map" or "ko", depending on package version |
A list of pathways associated to the KO terms input
Helper function that calculates the p-value of an adaptation of the Rao's spacing test for grouped data (discrete phases) as implemented in the article "Grouped circular data in biology: advice for effectively implementing statistical procedures" https://doi.org/10.1007/s00265-020-02881-6.
.RaoPGroupedRad(sample, m, iter = 9999).RaoPGroupedRad(sample, m, iter = 9999)
sample |
Data points in radians |
m |
Number of bins |
iter |
Number of iterations |
The p-value for the test
Helper function that calculates the p-value of Rao's spacing test for ungrouped data (continuous phases) as implemented in the article "Circular statistics meets practical limitations: a simulation-based Rao’s spacing test for non-continuous data" https://doi.org/10.1186/s40462-019-0160-x.
.RaoTestUngroupedRad(sample, iter = 9999).RaoTestUngroupedRad(sample, iter = 9999)
sample |
Data points in radians |
iter |
Number of iterations |
The p-value for the test
Helper function that calculates the critical value for Rao's spacing test as implemented in the article "Grouped circular data in biology: advice for effectively implementing statistical procedures" https://doi.org/10.1007/s00265-020-02881-6.
.RaoTestValue(sample).RaoTestValue(sample)
sample |
Data points in radians |
The critical value for the test
Function that takes the calculated circular summary, variance and p-values of Rayleigh, Kuiper, HR and Rao's tests and construct the result table.
.table_builder( circa_summary, circa_var, circa_kuiper, circa_ray, circa_hr, circa_rao ).table_builder( circa_summary, circa_var, circa_kuiper, circa_ray, circa_hr, circa_rao )
circa_summary |
Process or gene sets list (as the output of create_gene_list_go and create_gene_list_kegg) |
circa_var |
Table showing acrophases for the complete gene set under study, stated in hours |
circa_kuiper |
P-value estimated by Kuiper test |
circa_ray |
P-value estimated by Rayleigh test |
circa_hr |
P-value estimated by HR test |
circa_rao |
P-value estimated by Rao test |
A table indicating number of phases used for computation (n); mean, rho, variance, first, second and third quantiles of the circular distribution in hours; and p-values for each of the four tests
Function to create tracks for boxplots whose boxes intersect the origin. In this case, the segment must be cut from min to 24 and from 0 to max. Also, the box must be unfolded from first to 24 and from 0 to third quartiles.
.track_box_box_cut(tr.height, quan.table, i, my_color).track_box_box_cut(tr.height, quan.table, i, my_color)
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
quan.table |
A circular results table with sem info |
i |
Track counter |
my_color |
Color vector to use |
Plotted track
Function to create tracks for boxplots that do not intersect the origin. If neither of the segments cut the sunrise,
.track_box_no_cut(tr.height, quan.table, i, my_color).track_box_no_cut(tr.height, quan.table, i, my_color)
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
quan.table |
A circular results table with sem info |
i |
Track counter |
my_color |
Color vector to use |
Plotted track
Function to create tracks for boxplots whose segments intersect the origin.
.track_box_segments_cut(tr.height, quan.table, i, my_color).track_box_segments_cut(tr.height, quan.table, i, my_color)
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
quan.table |
A circular results table with sem info |
i |
Track counter |
my_color |
Color vector to use |
Plotted track
Function to create tracks for dotplot
.track_dot(tr.height, phases.list, i, my_color, my_transparent).track_dot(tr.height, phases.list, i, my_color, my_transparent)
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
phases.list |
A named phase tables list in the same format as the output of gene_list_to_phases |
i |
Track counter |
my_color |
Color vector to use |
my_transparent |
Transparent color vector to use |
Axis
Dataset example with phase information in two different conditions for Ostreococcus tauri from "Multiomics integration unveils photoperiodic plasticity in the molecular rhythms of marine phytoplankton" (https://doi.org/10.1093/plcell/koaf033)
data(circa_table_genescarab)data(circa_table_genescarab)
Data frame
Function to plot a circular boxplot showing the circular distribution of different processes or gene sets
circular_boxplot(res.table, color.palette = "Tam", tr.height = 0.1)circular_boxplot(res.table, color.palette = "Tam", tr.height = 0.1)
res.table |
A circular results table, as the output from complete_circular_table or complete_circular_table_grouped |
color.palette |
Color palette to use. Available palettes are those from MetBrewer |
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
A PNG file containing the plot
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 ) circular_boxplot(go.circa.table.sd[seq_len(2), ], color.palette = "Tam" )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 ) circular_boxplot(go.circa.table.sd[seq_len(2), ], color.palette = "Tam" )
Function to plot a circular dotplot showing the circular distribution of different processes or gene sets
circular_dotplot(phases.list, color.palette = "Tam", tr.height = 0.1)circular_dotplot(phases.list, color.palette = "Tam", tr.height = 0.1)
phases.list |
A named phase tables list in the same format as the output of gene_list_to_phases |
color.palette |
Color palette to use. Available palettes are those from MetBrewer |
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
A PNG file containing the plot
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] circular_dotplot(phases.list.sd.clean, color.palette = "Tam")org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] circular_dotplot(phases.list.sd.clean, color.palette = "Tam")
Function to plot a circular histogram showing the circular distribution of different processes or gene sets
circular_histogram( phases.list, color.palette = "Tam", tr.height = 0.08, nbins = 24 )circular_histogram( phases.list, color.palette = "Tam", tr.height = 0.08, nbins = 24 )
phases.list |
A phase tables list in the same format as the output of gene_list_to_phases |
color.palette |
Color palette to use. Available palettes are those from MetBrewer |
tr.height |
Height of each track. For more than 8 tracks, reduce this parameter |
nbins |
Number of bins (breaks) to split the histogram |
A PNG file containing the plot
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] circular_histogram(phases.list.sd.clean, color.palette = "Tam", nbins = 48 )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] circular_histogram(phases.list.sd.clean, color.palette = "Tam", nbins = 48 )
Function that takes a list of continuous phases associated with each process or gene set (output of the gene_list_to_phases function) and calculates the table of statistical measures and deviations from circular uniformity for each one using the Rayleigh, Kuiper, Hermans-Rasson, and Rao tests.
complete_circular_table( phase.list, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05 )complete_circular_table( phase.list, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05 )
phase.list |
Phases list in the same format as the output of gene_list_to_phases |
hr.on.large.sets.th |
Threshold indicating the maximum size of a set to perform HR test on |
iter.hr |
Number of iterations for HR test |
force.hr.th |
Significance level to execute HR test if Rayleigh and Kuiper p-values are higher |
rao.on.large.sets.th |
Threshold indicating the maximum size of a set to perform Rao test on |
iter.rao |
Number of iterations for Rao test |
force.rao.th |
Significance level to execute Rao test if Rayleigh, Kuiper and HR p-values are higher |
A data.frame indicating, for each process or gene set: number of phases used for computation (n); mean, rho, variance, first, second and third quantiles of the circular distribution in hours; p-values and adjusted p-values for each of the four tests
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric(circa_table_genescarab[["sd.peak.time.hours"]]) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric(circa_table_genescarab[["sd.peak.time.hours"]]) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 )
Function that takes a list of discrete phases associated with each process or gene set (output of the gene_list_to_phases function) and calculates the table of statistical measures and deviations from circular uniformity for each one using the adapted Rayleigh, Kuiper, Hermans-Rasson, and Rao tests.
complete_circular_table_grouped( phase.list, n_bins, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05, kuiper.on.large.sets.th = 400, iter.kuiper = 999, force.kuiper.th = 0.05 )complete_circular_table_grouped( phase.list, n_bins, hr.on.large.sets.th = 400, iter.hr = 999, force.hr.th = 0.05, rao.on.large.sets.th = 400, iter.rao = 999, force.rao.th = 0.05, kuiper.on.large.sets.th = 400, iter.kuiper = 999, force.kuiper.th = 0.05 )
phase.list |
Phases list in the same format as the output of gene_list_to_phases |
n_bins |
Number of bins |
hr.on.large.sets.th |
Threshold indicating the maximum size of a set to perform HR test on |
iter.hr |
Number of iterations for HR test |
force.hr.th |
Significance level to execute HR test if Rayleigh and Kuiper p-values are higher |
rao.on.large.sets.th |
Threshold indicating the maximum size of a set to perform Rao test on |
iter.rao |
Number of iterations for Rao test |
force.rao.th |
Significance level to execute Rao test if Rayleigh, Kuiper and HR p-values are higher |
kuiper.on.large.sets.th |
Threshold indicating the maximum size of a set to perform kuiper test on |
iter.kuiper |
Number of iterations for kuiper test |
force.kuiper.th |
Significance level to execute Kuiper test if Rayleigh p-value is higher |
A data.frame indicating, for each process or gene set: number of phases used for computation (n); mean, rho, variance, first, second and third quantiles of the circular distribution in hours; p-values and adjusted p-values for each of the four tests
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) total_phases_table_sd_grouped <- data.frame( names = total_phases_table_sd$names, phase = trunc(total_phases_table_sd$phase) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd_grouped ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table_grouped( phase.list = phases.list.sd.clean, n_bins = 24, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) total_phases_table_sd_grouped <- data.frame( names = total_phases_table_sd$names, phase = trunc(total_phases_table_sd$phase) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd_grouped ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table_grouped( phase.list = phases.list.sd.clean, n_bins = 24, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 )
Function to create a list of genes associated with each GO term based on a species annotation package. This includes all ancestor GO terms of the selected ones.
create_gene_list_go(go_vector = c("all"), org.package, go_column, id_column)create_gene_list_go(go_vector = c("all"), org.package, go_column, id_column)
go_vector |
GO terms vector to be included in the analysis, along with their ancestors. "all" takes the complete set from the annotation package |
org.package |
OrgDb object from species annotation package (*.db) |
go_column |
GO term column name in the annotation package |
id_column |
Gene ID column name in the annotation package |
A list linking each GO term with the genes that share that annotation
org_Otaurireduced_eg_db <- load_example_annot() go.list.test <- create_gene_list_go( go_vector = "GO:0005515", org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" )org_Otaurireduced_eg_db <- load_example_annot() go.list.test <- create_gene_list_go( go_vector = "GO:0005515", org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" )
Function to create a list of genes associated with each KEGG pathway based on a species annotation package with KO terms derived from KEGGREST, KAAS or similar tools. It also allows filtering by species group.
create_gene_list_kegg( ko_vector = c("all"), org.package, ko_column, id_column, ko_prefix = "map", species = "all" )create_gene_list_kegg( ko_vector = c("all"), org.package, ko_column, id_column, ko_prefix = "map", species = "all" )
ko_vector |
KO vector to be included in the analysis, along with their pathways ancestors. "all" takes the complete set from the annotation package |
org.package |
OrgDb object from species annotation package (*.db) |
ko_column |
KO column name in the annotation package |
id_column |
Gene ID column name in the annotation package |
ko_prefix |
Prefix used to denote KEGG pathways, either "map" or "ko", depending on package version |
species |
Species group to filter final pathways ("all" for no filtering), either "bacteria", "archaea", "animals", "plants", "fungi" or "protists" |
A list linking each KEGG pathway with the genes that share that annotation
org_Otaurireduced_eg_db <- load_example_annot() create_gene_list_kegg( ko_vector = "K10666", org.package = org_Otaurireduced_eg_db, ko_column = "KO", id_column = "GID", ko_prefix = "map", species = "plants" )org_Otaurireduced_eg_db <- load_example_annot() create_gene_list_kegg( ko_vector = "K10666", org.package = org_Otaurireduced_eg_db, ko_column = "KO", id_column = "GID", ko_prefix = "map", species = "plants" )
Function that measures the contribution to the mean and rho of the circular distribution of a process or gene set for each of its constituent genes by removing them one by one. For sets consisting on more than 100 genes, it takes a random sample of 100 gene phases to normalize and ensure noticiable changes.
gene_contribution_to_set(circa_result, phase_list)gene_contribution_to_set(circa_result, phase_list)
circa_result |
Table with circular distribution results, as the output from complete_circular_table or complete_circular_table_grouped |
phase_list |
Phases list in the same format as the output of gene_list_to_phases, containing the row names of circa_result as names of each element |
A list whose elements are tables indicating the difference in circular mean and rho due to removing each gene for each process or gene set, and the rank of each difference
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames( circa_table_genescarab ), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 ) gene_contributions <- gene_contribution_to_set( circa_result = go.circa.table.sd[1, ], phase_list = phases.list.sd.clean[rownames( go.circa.table.sd )[1]] )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames( circa_table_genescarab ), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 ) gene_contributions <- gene_contribution_to_set( circa_result = go.circa.table.sd[1, ], phase_list = phases.list.sd.clean[rownames( go.circa.table.sd )[1]] )
Function that takes a list of genes associated with specific biological processes (GO, KEGG) or gene sets and a general phase table, and returns a list consisting of the phase tables specific to each set.
gene_list_to_phases(gene.list, phase.table)gene_list_to_phases(gene.list, phase.table)
gene.list |
Process or gene sets list (as the output of create_gene_list_go and create_gene_list_kegg) |
phase.table |
Table showing acrophases for the complete gene set under study, stated in hours. It must have two columns, named "names" and "phase" |
A list containing phase tables for each process or gene set
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) go.list.test <- create_gene_list_go( go_vector = "GO:0005515", org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) gene_list_to_phases(go.list.test, total_phases_table_sd)org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) go.list.test <- create_gene_list_go( go_vector = "GO:0005515", org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) gene_list_to_phases(go.list.test, total_phases_table_sd)
GeneSCARAB provides methods for analyzing the cohesion and clustering toward specific points in the cycle of biological sets (genes, metabolites, ...) for chronobiology studies following the proposed best practices in circular statistics.
The typical workflow is:
Load element phases as a table and species annotation package.
Construct the phases list for the desired sets or processes.
Compute circular statistics and departure from uniformity for each set.
For non-uniform sets, compare against global phase distribution.
In the case of multiple conditions, determine differentially timed sets between conditions.
For multimodal sets, analyze the number of modes and cluster its elements.
Calculate contribution of each element to its set's statistics.
Plot results as circular boxplot, dotplot or histogram.
load_example_annot() loads example annotation data.
create_gene_list_go() creates a list of elements associated with each GO
term based on a species annotation package.
create_gene_list_kegg() create a list of elements associated with each
KEGG pathway based on a species annotation package.
gene_list_to_phases() takes a list of elements associated with
specific sets and a complete phase table, and returns a list
consisting of the individual phase tables of each set.
complete_circular_table() calculates the table of statistical measures
and deviations from circular uniformity of each set.
complete_circular_table_grouped() calculates the table of statistical
measures and deviations from circular uniformity of each set (for
discrete phases).
test_against_gen_dist() compares whether the distributions
of specific sets significantly differ from the overall phase distribution
of the entire dataset
test_two_dist() compares whether the distributions of specific
sets differ significantly between two different conditions or genotypes.
gene_contribution_to_set() measures the contribution of each element
of the set to the mean and rho of the entire set.
multimodal_analysis() determines the most likely number of modes
in the presence of f-fold symmetry (1, 2 or 3),
cluster elements in f clusters and determine the circular statistic
summary for each cluster
circular_boxplot() creates circular boxplot.
circular_dotplot() creates circular dotplot.
circular_histogram() creates circular histogram.
See the package vignette for a complete tutorial.
Maintainer: Marcos Ramos-González [email protected] (ORCID)
Authors:
Marcos Ramos-González [email protected] (ORCID)
Other contributors:
Emma Serrano-Pérez [email protected] (ORCID) [contributor]
Víctor Ramos-González [email protected] (ORCID) [contributor]
Mercedes García-González [email protected] (ORCID) [contributor]
Francisco J. Romero-Campero [email protected] (ORCID) [contributor]
Useful links:
Report bugs at https://github.com/ramosgonzmarc/GeneSCARAB
Loading SQlite containing GO and KO annnotation info for Ostreococcus tauri in AnnotationForge's output format. Original genome and annotation package were download from https://github.com/fran-romero-campero/AlgaeFUN and KO information was generated via KAAS (https://www.genome.jp/kaas-bin/kaas_main).
load_example_annot()load_example_annot()
OrgDb object
org_Otaurireduced_eg_db <- load_example_annot()org_Otaurireduced_eg_db <- load_example_annot()
Function to determine the most likely number of modes in the presence of f-fold symmetry (1, 2 or 3), cluster genes in f clusters and determine the statistic summary for each cluster
multimodal_analysis(phase_table)multimodal_analysis(phase_table)
phase_table |
A phase table, as the individual elements of the list derived from gene_list_to_phases |
A list containing the most likely mode number, the p-value for that number, the p-values corresponding to each mode number, the circular summary table for each cluster and the genes contained in each cluster
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample(seq_len( length(complete_gos) ), 50, replace = FALSE)] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 ) multi_table <- go.circa.table.sd[which( go.circa.table.sd$hr_p_value < 0.05 & go.circa.table.sd$n > 2 ), ] multi_go <- rownames(multi_table)[1] phase_table_multi_go <- phases.list.sd.clean[[multi_go]] multimodal_list <- multimodal_analysis(phase_table_multi_go)org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample(seq_len( length(complete_gos) ), 50, replace = FALSE)] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )] go.circa.table.sd <- complete_circular_table( phase.list = phases.list.sd.clean, hr.on.large.sets.th = 200, force.hr.th = 0.04, rao.on.large.sets.th = 200, force.rao.th = 0.04, iter.rao = 999, iter.hr = 999 ) multi_table <- go.circa.table.sd[which( go.circa.table.sd$hr_p_value < 0.05 & go.circa.table.sd$n > 2 ), ] multi_go <- rownames(multi_table)[1] phase_table_multi_go <- phases.list.sd.clean[[multi_go]] multimodal_list <- multimodal_analysis(phase_table_multi_go)
Function that compares whether the distributions of specific processes or gene sets differ significantly from the overall phase distribution of the entire study. Significance is calculated based on a MANOVA analysis as described in https://doi.org/10.1186/s40462-022-00323-8.
test_against_gen_dist(phase.list, total.phase.table)test_against_gen_dist(phase.list, total.phase.table)
phase.list |
Phases list in the same format as the output of gene_list_to_phases |
total.phase.table |
Table showing acrophases for the complete gene set under study, stated in hours |
A data.frame with p-value and adjusted p-value (null hyphotesis: same distribution as the general one) for each process or gene set
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] not_experimentally_distributed_gos <- test_against_gen_dist( phases.list.sd.clean, total_phases_table_sd )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] not_experimentally_distributed_gos <- test_against_gen_dist( phases.list.sd.clean, total_phases_table_sd )
Function that compares whether the distributions of specific processes or gene sets differ significantly between two different conditions or genotypes. The two lists must have the same number of elements, although the number of genes associated with each process or gene set may differ. Significance is calculated based on a MANOVA analysis as described in https://doi.org/10.1186/s40462-022-00323-8.
test_two_dist(phase.list.1, phase.list.2)test_two_dist(phase.list.1, phase.list.2)
phase.list.1 |
Phases list for condition 1, in the same format as the output of gene_list_to_phases |
phase.list.2 |
Phases list for condition 2, in the same format as the output of gene_list_to_phases |
A data.frame with p-value and adjusted p-value (null hyphotesis: same distribution in both conditions) for each process or gene set
org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) total_phases_table_ld <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["ld.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] phases.list.ld <- gene_list_to_phases( go.list.test, total_phases_table_ld ) phases.list.ld.clean <- phases.list.ld[which( sapply(phases.list.ld, nrow) != 0 )][names(phases.list.sd.clean)] diff_distributed_gos <- test_two_dist( phases.list.ld.clean, phases.list.sd.clean )org_Otaurireduced_eg_db <- load_example_annot() data("circa_table_genescarab") total_phases_table_sd <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["sd.peak.time.hours"]] ) ) total_phases_table_ld <- data.frame( names = rownames(circa_table_genescarab), phase = as.numeric( circa_table_genescarab[["ld.peak.time.hours"]] ) ) functional_data <- AnnotationDbi::select(org_Otaurireduced_eg_db, keys = AnnotationDbi::keys(org_Otaurireduced_eg_db, keytype = "GID"), columns = c("GID", "GO") ) complete_gos <- unique(functional_data$GO) complete_gos <- complete_gos[!is.na(complete_gos)] set.seed(2345) subset_gos <- complete_gos[sample( seq_len(length(complete_gos)), 50, replace = FALSE )] go.list.test <- create_gene_list_go( go_vector = subset_gos, org.package = org_Otaurireduced_eg_db, go_column = "GO", id_column = "GID" ) phases.list.sd <- gene_list_to_phases( go.list.test, total_phases_table_sd ) phases.list.sd.clean <- phases.list.sd[which( sapply(phases.list.sd, nrow) != 0 )][seq_len(3)] phases.list.ld <- gene_list_to_phases( go.list.test, total_phases_table_ld ) phases.list.ld.clean <- phases.list.ld[which( sapply(phases.list.ld, nrow) != 0 )][names(phases.list.sd.clean)] diff_distributed_gos <- test_two_dist( phases.list.ld.clean, phases.list.sd.clean )