InputControl: A class for controlling and validating inputs
InputControl.Rd
InputControl: A class for controlling and validating inputs
InputControl: A class for controlling and validating inputs
Details
This class provides methods to validate the inputs of a function.
The method performs the following checks:
* Ensures that both `annotation` and `data` are provided. * Confirms that `annotation` is a dataframe. * Verifies that `annotation` and `data` have the same number of rows.
If any of these checks fail, an informative error message is returned.
The function performs the following checks: - If `clusters` is an integer or a vector of integers. Otherwise, it gives an error.
Check Plot Info
The method performs the following checks:
* Ensures that `plot_info` is provided and not NULL. * Confirms that `y_axis_label` is a character vector with maximally 30 characters. * Confirms that `time_unit` is a character vector with maximally 15 characters. * Validates that `treatment_labels` is either `NA` or a character vector with each element being maximally 15 characters long. * Validates that `treatment_timepoints` is either `NA` or a numeric vector with the same length as `treatment_labels` if `treatment_labels` is not `NA`.
If any of these checks fail, an informative error message is returned.
This function performs the following checks: 1. Ensures `feature_name_columns` and `annotation` are not `NULL`. 2. Verifies that each element in `feature_name_columns` is a character with a length of 1. 3. Checks that all elements of `feature_name_columns` are valid column names in the `annotation` data frame.
Check Report
The function performs the following checks: - Whether the `report` argument is present. - If `report` is not a Boolean value (`TRUE` or `FALSE`), it throws an error.
Functions
InputControl
: This method verifies the spline test configurations and associated metadata within the object's arguments. It performs a series of checks on the configurations, including column verification, spline type validation, and ensuring that the degrees of freedom (dof) are within acceptable ranges.
Super classes
SplineOmics::Level4Functions
-> SplineOmics::Level3Functions
-> SplineOmics::Level2Functions
-> InputControl
Methods
Inherited methods
SplineOmics::Level4Functions$create_error_message()
SplineOmics::Level3Functions$check_batch_column()
SplineOmics::Level3Functions$check_condition_time_consistency()
SplineOmics::Level3Functions$check_voom_structure()
SplineOmics::Level2Functions$check_columns()
SplineOmics::Level2Functions$check_columns_spline_test_configs()
SplineOmics::Level2Functions$check_data()
SplineOmics::Level2Functions$check_dataframe()
SplineOmics::Level2Functions$check_max_and_min_dof()
SplineOmics::Level2Functions$check_meta()
SplineOmics::Level2Functions$check_spline_params_generally()
SplineOmics::Level2Functions$check_spline_params_mode_dependent()
SplineOmics::Level2Functions$check_spline_type_column()
SplineOmics::Level2Functions$check_spline_type_params()
Method new()
Usage
InputControl$new(args)
Returns
A new instance of the InputControl class.
Automatically Validate All Arguments
This method automatically validates all arguments by sequentially calling various validation methods defined within the class. Each validation method checks specific aspects of the input arguments and raises an error if the validation fails.
The following validation methods are called in sequence:
- self$check_data_and_meta()
- self$check_datas_and_metas()
- self$check_datas_descr()
- self$check_design_formula()
- self$check_mode()
- self$check_modes()
- self$check_designs_and_metas()
- self$check_spline_params()
- self$check_spline_test_configs()
- self$check_adj_pthresholds()
- self$check_clusters()
- self$check_time_unit()
- self$check_report_dir()
- self$check_padjust_method()
- self$check_report_info()
- self$check_report()
- self$check_feature_name_columns()
Method check_data_and_meta()
This function checks the validity of the data and meta objects, ensuring that data is a matrix with numeric values and that meta is a dataframe containing the specified condition column. Additionally, it verifies that the number of columns in the data matrix matches the number of rows in the meta dataframe.
Arguments
data
A matrix containing numeric values.
meta
A dataframe containing the metadata, including the 'Time' column and the specified condition column.
condition
A single character string specifying the column name in the meta dataframe to be checked.
meta_batch_column
An optional parameter specifying the column name in the meta dataframe used to remove the batch effect. Default is NA.
data_meta_index
An optional parameter specifying the index of the data/meta pair for error messages. Default is NA.
Method check_annotation()
This method checks the consistency of the annotation with the data. It ensures that the annotation is a dataframe and that it has the same number of rows as the data.
Method check_datas_and_metas()
Iterates over multiple data and meta pairs to validate each pair using the `check_data_and_meta` function.
Arguments
datas
A list of matrices containing numeric values.
metas
A list of data frames containing metadata.
condition
A character string specifying the column name in the meta dataframe to be checked.
meta_batch_column
An optional parameter specifying the column name in the meta dataframe used to remove the batch effect. Default is NA.
meta_batch2_column
An optional parameter specifying the column name in the meta dataframe used to remove the second batch effect. Default is NA.
Method check_datas_descr()
Validates that the data descriptions are character vectors with each element not exceeding 80 characters in length.
Method check_top_tables()
Validates that the top tables are a list of dataframes and checks each dataframe using the `check_dataframe` function.
Method check_design_formula()
Validates the design formula ensuring it is a valid character string, contains allowed characters, includes the intercept term 'X', and references columns present in the metadata.
Method check_modes()
This function iterates over the `modes` argument, sets each `mode` in `self$args`, and calls `check_mode()` to validate each mode. After each validation, the `mode` is removed from `self$args`.
Method check_mode()
This function checks if the `mode` argument is provided and validates that it is either "isolated" or "integrated". If `mode` is missing or invalid, an error is thrown.
Method check_designs_and_metas()
Iterates over multiple design formulas and corresponding metadata to validate each pair using the `check_design_formula` function.
Method check_spline_params()
Validates the spline parameters both generally and depending on the specified mode.
Method check_spline_test_configs()
Arguments
spline_test_configs
A configuration object for spline tests.
metas
A list of metadata corresponding to the data matrices.
Returns
Returns `NULL` if any required arguments are mising, otherwise, called for side effects.
Check Limma Top Tables Structure
This function checks if the provided limma top tables data structure is correctly formatted. It ensures that the data structure contains exactly three named elements ('time_effect', 'avrg_diff_conditions', and 'interaction_condition_time') and that each element contains dataframes with the correct columns and data types.
Method check_adj_pthresholds()
This function checks the validity of the adjusted p-thresholds vector, ensuring that all elements are numeric, greater than 0, and less than 1. If any of these conditions are not met, the function stops execution and returns an error message indicating the offending elements.
Method check_adj_pthresh_limma_category_2_3()
This function checks that both adjusted p-value thresholds for average difference conditions and interaction condition time are non-null, floats, and in the range [0, 1].
Method check_clusters()
This function verifies the cluster configurations within the object's arguments. It checks if the clusters argument is present and performs validation on its content. If no clusters are specified, it defaults to automatic cluster estimation.
Method check_plot_info()
This method checks the validity of the `plot_info` list. It ensures that `y_axis_label` and `time_unit` meet the length constraints, `treatment_labels` is either `NA` or a character vector with elements meeting the length constraint, and `treatment_timepoints` is either `NA` or a numeric vector with the same length as `treatment_labels`.
Method check_plot_options()
This method checks if the `plot_options` list contains the required elements `meta_replicate_column` and `cluster_heatmap_columns`. It validates that `cluster_heatmap_columns` is either TRUE or FALSE, and that `meta_replicate_column` is a valid column name in the `meta` dataframe. If the checks fail, the script stops with an error message.
Check and Create Report Directory
Method check_report_dir()
This function checks if the specified report directory exists and is a valid directory. If the directory does not exist, it attempts to create it. If there are any warnings or errors during directory creation, the function stops execution and returns an error message.
Method check_genes()
This function checks the validity of the `data` and `genes` arguments within the `self$args` list. It ensures that `genes` is a character vector, that neither `data` nor `genes` is `NULL`, and that the length of `genes` matches the number of rows in `data`.
Method check_padjust_method()
This function checks if the provided p-adjustment method is valid. The valid methods are: "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", and "none". If the method is not one of these, the function stops execution and returns an error message.
Method check_report_info()
Validates the report information to ensure it contains all mandatory fields and adheres to the required formats.
Method check_feature_name_columns()
This function checks whether all elements of `feature_name_columns` are characters of length 1 and whether they are valid column names in the `annotation` data frame.
Method check_report()
This function verifies the `report` argument within the object's arguments. It checks if the `report` argument is present and validates its Boolean value.