
Get General Linear Model Scores.
get_glm.RdRun a Mann-Whitney and general linear regression on a set of prediction scores.
Usage
get_glm(
these_predictions = NULL,
these_samples_metadata = NULL,
subtype_class = "5_class",
scale = NULL,
bin_scores = TRUE,
n_bins = 10,
this_subtype = NULL,
categorical_factor = NULL,
predictor_columns = NULL,
exclude_columns = NULL,
row_to_col = FALSE,
sample_id_col = NULL
)Arguments
- these_predictions
Required parameter. A data frame with predictions scores from
classify_samples.- these_samples_metadata
Required, a data frame with metadata associated with the prediction calls, Note, the function will subset the return to samples are included in this object.
- subtype_class
Can be one of the following; 5_class or 7_class. Default is 5_class.
- scale
Optional parameter. A numeric value to scale the numeric scores. If provided, all numeric scores will be multiplied by this value.
- bin_scores
Boolean parameter. Set to TRUE to bin the numeric scores into discrete bins. Default is TRUE
- n_bins
Optional parameter. The number of bins to use when binning numeric scores. Default is 10.
- this_subtype
Optional parameter. Allows the user to subset the return to a specific subtype within the selected class. If not specified, the function will return a data frame with subtype information for all the subtypes within the specified class.
- categorical_factor
Required parameter. Specify the two level categorical variable you want to test for.
- predictor_columns
Optional, should be a vector with column names, either from the provided metadata or signature score object, to be tested for. If not provided, the function will subset data to the signature scores returned with
classify_samples.- exclude_columns
Optional argument, specify columns you wish to exclude from the standard predictor columns. Note, this parameter is only validated if predictor_columns is NULL (default).
- row_to_col
Boolean parameter. Set to TRUE to transform row names of the metadata to a new column called sample_id. Default is FALSE.
- sample_id_col
Parameter dictating the column name with sample IDs, the function expects this column to be sample_id but the user can override this if they know the name for this column.
Details
This function takes a data frame with prediction data these_predictions and executes
statistical tests to find significant prediction scores based on a categorical variable (i.e
response,tumour grade, etc.) from a provided metadata table. Currently, the function expects the
incoming data to be the score output from classify_samples(), together with metadata
information of interest (e.g two level categorical) and subtype classification information. The
user have the option to point the function to the categorical variable with categorical_factor.
The return can be further subset by subtype by using the this_subtype variable, should be one
of the valid subtypes within the specified class.
Examples
#run classifier
sjodahl_classes = classify_samples(this_data = sjodahl_2017,
log_transform = FALSE,
adjust = TRUE,
impute = TRUE,
include_data = TRUE,
verbose = FALSE)
#run general linear models
sjodahl_glm_uro = get_glm(these_predictions = sjodahl_classes,
these_samples_metadata = sjodahl_2017_meta,
subtype_class = "5_class",
this_subtype = "Uro",
categorical_factor = "adj_chemo")
#> Filtering prediction data on the selected subtype(s)...
#> 121 samples kept after filtering on subtype and metadata...
sjodahl_glm_all = get_glm(these_predictions = sjodahl_classes,
these_samples_metadata = sjodahl_2017_meta,
subtype_class = "5_class",
this_subtype = NULL,
bin_scores = FALSE,
categorical_factor = "adj_chemo")
#> 267 samples kept after filtering on subtype and metadata...
#view data
head(sjodahl_glm_uro)
#> score p_value odds_ratio conf_2.5 conf_97.5 variable
#> 1 proliferation_score 0.01978721 1.7308844 1.1418187 2.765177 adj_chemo
#> 2 progression_score 0.01630708 1.6464287 1.0269821 2.764834 adj_chemo
#> 3 stromal141_up 0.69023479 1.0586900 0.7355220 1.507109 adj_chemo
#> 4 immune141_up 0.78738969 0.9158293 0.6419651 1.296604 adj_chemo
#> 5 b_cells 0.60737341 0.8829891 0.5845830 1.260514 adj_chemo
#> 6 t_cells 0.31610677 0.8126063 0.5428602 1.175414 adj_chemo
#> subtype
#> 1 Uro
#> 2 Uro
#> 3 Uro
#> 4 Uro
#> 5 Uro
#> 6 Uro