prepareDataforGlm: Prepare a dataset for GLM analysis

Description Usage Arguments Value Examples

View source: R/prepareDataforGlm.R

Description

Given two design matrices (one corresponding to a knockdown and one to a control well), create a concatenated design matrix with a column "Response" encoding for original membership. This unified data matrix is then divided into 90 variables containing NA/NaN are dropped.

Usage

1
2
prepareDataforGlm(active, control, drop.feat = NULL, drop.sep = FALSE,
  test = 10, verbose = FALSE)

Arguments

active

Data coming from a well where a gene knockdown occurred.

control

Data belonging to a control well.

drop.feat

A vector of strings of column names that will be dropped.

drop.sep

Drop variables that separate data.

test

The fraction of rows to be used for testing is 1/test. If NULL is supplied, all data is used for training.

verbose

Whether to list all modified/dropped features

Value

A list with entries "test" and "train" each holding a data frame containing a design matrix and a response vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# get gene locations
mtor.loc <- findWells(experiments="brucella-du-k1", contents="MTOR")
scra.loc <- findWells(plates=sapply(mtor.loc, getBarcode),
                      contents="SCRAMBLED", well.names="G23")
# combine for faster fetching
data     <- getSingleCellData(list(mtor.loc[[1]], scra.loc[[1]]))
mtor.dat <- meltData(cleanData(data[[1]]$H6))
scra.dat <- meltData(cleanData(data[[1]]$G23))
# prepare data for glm
data <- prepareDataforGlm(mtor.dat$mat$Cells, scra.dat$mat$Cells)
data <- makeRankFull(data)
# run glm
model <- glm("Response ~ .", binomial, data$train)

nbenn/singleCellFeatures documentation built on May 23, 2019, 12:24 p.m.