R/method_adjust_confounder.R
adjust_confounder.Rd
This function adjusts for confounders in the expression data of a mass_dataset
object.
The function takes a list of confounders from the sample_info
data and performs a
linear regression adjustment on the expression data for each specified confounder.
adjust_confounder(object, confounder_name_list)
A modified mass_dataset
object with adjusted expression data where confounders
have been accounted for.
This function performs a linear model regression for each feature in the expression data
against the specified confounders from the sample information. The residuals of the model
are used as the adjusted expression data. If any NA values are present in the confounders
or if the confounder names are not found in the sample_info
, the function will stop
and return an error.
The function will stop if confounder_name_list
is empty.
The function will stop if any of the confounder names in confounder_name_list
are not present in the sample_info
.
The function will stop if any NA values are present in the specified confounders.
if (FALSE) { # \dontrun{
# Assuming `mass_object` is a valid mass_dataset object and `confounders` is a vector
# of column names from the sample_info slot.
adjusted_object <- adjust_confounder(object = mass_object, confounder_name_list = confounders)
} # }