Learn R Programming

CSeQTL (version 1.0.0)

CSeQTL_linearTest: CSeQTL_linearTest

Description

Runs marginal and cell type-specific analysis using ordinary least squares.

Usage

CSeQTL_linearTest(
  input,
  XX,
  RHO,
  SNP,
  YY = NULL,
  MARG = FALSE,
  impute_geno = FALSE,
  trim = FALSE,
  thres_TRIM = 10,
  show_plot = TRUE,
  main_plot = "",
  CTs = NULL
)

Value

A R list containing lm() output for lm_out, a R dataframe for out_df containing regression estimates, standard errors, p-values. res_trim provides a summary of trimmed results over a grid of cut-off values and number of samples trimmed. cooksd is a numeric vector of median shifted and MAD scaled Cook's distances per sample. prop_trim, a numeric value for number of samples with outcome values trimmed for the user-specified thres_TRIM value.

Arguments

input

A data.frame containing columns total (total read counts) and log_lib_size (log transformed library size).

XX

A numeric design matrix of baseline covariates including the intercept in the first column and centered continuous covariates.

RHO

A numeric matrix of cell type proportions. Rows correspond to subjects and columns correspond to cell types.

SNP

An integer vector of phased genotypes coded 0 (AA), 1 (AB), 2 (BA), 3 (BB), and 5 (NA).

YY

Default is NULL. By default, the outcome for OLS is the inverse rank quantile normalized TReC after library size correction. Otherwise, the user can input their own transformed outcome as a numeric vector.

MARG

Boolean value. Set to TRUE to fit the marginal OLS model. Default is set to FALSE to fit the cell type-specific interaction OLS model.

impute_geno

Boolean value. Default is set to FALSE to only analyze subjects with non-missing genotype. If TRUE, missing genotypes are imputed with the mean of non-missing genotypes mimicing MatrixEQTL.

trim

Boolean value set to FALSE by default to prevent outcome trimming. If TRUE, the OLS model will be fitted without covariates containing SNP genotype to calculate each subject's Cooks' distance.

thres_TRIM

A positive numeric value to perform subject outcome trimming. Subjects with standardized Cooks' Distances greater than the threshold are trimmed.

show_plot

Boolean value set to TRUE to visualize boxplot or interactions.

main_plot

Character string for the visual's main title.

CTs

Set to NULL by default. If NULL and show_plot = TRUE, all cell type interaction plots are shown. Otherwise a subset of cell types can be displayed using an integer vector of columns or character vector of column names of RHO can be provided.