regsplice: Wrapper function to run regsplice.

View source: R/regsplice_wrapper.R

regspliceR Documentation

Wrapper function to run regsplice.

Description

Wrapper function to run a regsplice analysis with a single command.

Usage

regsplice(
  rs_data,
  filter_zeros = TRUE,
  filter_low_counts = TRUE,
  filter_min_per_exon = 6,
  filter_min_per_sample = 3,
  normalize = TRUE,
  norm_method = "TMM",
  voom = TRUE,
  alpha = 1,
  lambda_choice = c("lambda.min", "lambda.1se"),
  when_null_selected = c("ones", "full", "NA"),
  seed = NULL,
  ...
)

Arguments

rs_data

RegspliceData object containing input data. See RegspliceData for details.

filter_zeros

Whether to filter zero-count exon bins, using filterZeros. Default is TRUE. Set to FALSE for exon microarray data.

filter_low_counts

Whether to filter low-count exon bins, using filterLowCounts. Default is TRUE. Set to FALSE for exon microarray data.

filter_min_per_exon

Filtering parameter for low-count exon bins: minimum number of reads per exon bin, summed across all biological samples. Default is 6. See filterLowCounts for details.

filter_min_per_sample

Filtering parameter for low-count exon bins: minimum number of reads per biological sample; i.e. for each exon bin, at least one sample must have this number of reads. Default is 3. See filterLowCounts for details.

normalize

Whether to calculate normalization factors, using runNormalization. Default is TRUE. If FALSE, non-normalized library sizes will be used. Set to FALSE for exon microarray data.

norm_method

Normalization method to use. Options are "TMM", "RLE", "upperquartile", and "none". Default is "TMM". See runNormalization for details.

voom

Whether to calculate limma-voom transformation and weights, using runVoom. Default is TRUE. If FALSE, model fitting functions will use the raw input data (not recommended for count data) with exon bins weighted equally. Set to FALSE for exon microarray data.

alpha

Elastic net parameter alpha for glmnet model fitting functions. Must be between 0 (ridge regression) and 1 (lasso). Default is 1 (lasso). See glmnet documentation for more details.

lambda_choice

Parameter to select which optimal lambda value to choose from the cv.glmnet cross validation fit. Choices are "lambda.min" (model with minimum cross-validated error) and "lambda.1se" (most regularized model with cross-validated error within one standard error of minimum). Default is "lambda.min". See glmnet documentation for more details.

when_null_selected

Which option to use for genes where the lasso model selects zero interaction terms, i.e. identical to the null model. Options are "ones", "full", and "NA". Default is "ones". See LRTests for details.

seed

Random seed (integer). Default is NULL. Provide an integer value to set the random seed for reproducible results.

...

Other arguments to pass to cv.glmnet, glmnet, or glm.

Details

This wrapper function runs the regsplice analysis pipeline with a single command.

The required input format is a RegspliceData object, which is created with the RegspliceData constructor function.

The wrapper function calls each of the individual functions in the analysis pipeline in sequence. You can also run the individual functions directly, which provides additional flexibility and insight into the statistical methodology. See the vignette for a description of the individual functions and an example workflow.

After running the analysis pipeline, a summary table of the results can be displayed with summaryTable.

Note that when using exon microarray data, the filtering, normalization, and voom steps should be disabled with the respective arguments.

See RegspliceData for details on constructing the input data object; filterZeros and filterLowCounts for details about filtering; runNormalization and runVoom for details about calculation of normalization factors and voom transformation and weights; createDesignMatrix for details about the model design matrices; fitRegMultiple, fitNullMultiple, or fitFullMultiple for details about the model fitting functions; and LRTests for details about the likelihood ratio tests.

Value

Returns a RegspliceResults object containing fitted model results and likelihood ratio (LR) test results. The LR test results consist of the following entries for each gene:

  • p_vals: raw p-values

  • p_adj: multiple testing adjusted p-values (Benjamini-Hochberg false discovery rates, FDR)

  • LR_stats: likelihood ratio test statistics

  • df_tests: degrees of freedom of likelihood ratio tests

See Also

RegspliceData RegspliceResults initializeResults filterZeros filterLowCounts runNormalization runVoom createDesignMatrix fitRegMultiple fitNullMultiple fitFullMultiple LRTests summaryTable

Examples

file_counts <- system.file("extdata/vignette_counts.txt", package = "regsplice")
data <- read.table(file_counts, header = TRUE, sep = "\t", stringsAsFactors = FALSE)
head(data)

counts <- data[, 2:7]
tbl_exons <- table(sapply(strsplit(data$exon, ":"), function(s) s[[1]]))
gene_IDs <- names(tbl_exons)
n_exons <- unname(tbl_exons)
condition <- rep(c("untreated", "treated"), each = 3)

rs_data <- RegspliceData(counts, gene_IDs, n_exons, condition)

rs_results <- regsplice(rs_data)

summaryTable(rs_results)


lmweber/regsplice documentation built on March 19, 2024, 1:45 p.m.