regress_against_covariate: Regress against covariates for trcQTL

Description Usage Arguments Value Examples

View source: R/rlib_covariate.R

Description

Given total read count (trc, N x 1) and library size (lib_size, N x 1) along with covarites (N x C), regress covariates against log(trc / lib_size / 2) by two-step approach 1. Regress all covariates against response and select significant ones (alpha = 0.05) 2. Regress the selected covariates against response and return the predicted response

Usage

1
regress_against_covariate(trc, lib_size, covariates)

Arguments

trc

total read count (dimension = N x 1)

lib_size

library size (dimension = N x 1) If it is set to NULL, we consider trc as y and do not do any transformation.

covariates

covariates (dimension = C x N) with the first column indicating the covariate name

Value

predicted response based on the selected covariates (if no covariates are selected, fill in zeros)

Examples

1
2
3
4
5
6
7
8
regress_against_covariate(
  trc = rpois(100, 100),
  lib_size = rpois(100, 10000),
  covariates = cbind(
    data.frame(name = paste0('cov', 1:10)),
    as.data.frame(matrix(runif(1000), nrow = 10))
  )
)

liangyy/mixqtl documentation built on Sept. 17, 2020, 11:36 a.m.