| kmFit | R Documentation | 
Run lmerel and corresponding lm or lme without kinship of gene expression in RNA-seq data
kmFit(
  dat = NULL,
  kin = NULL,
  patientID = "ptID",
  libraryID = "libID",
  counts = NULL,
  meta = NULL,
  genes = NULL,
  weights = NULL,
  subset_var = NULL,
  subset_lvl = NULL,
  subset_genes = NULL,
  model,
  use_weights = FALSE,
  run_lm = FALSE,
  run_lme = FALSE,
  run_lmerel = FALSE,
  metrics = FALSE,
  run_contrast = FALSE,
  contrast_var = NULL,
  processors = NULL,
  p_method = "BH",
  genotype_name = NULL,
  run.lmekin = NULL,
  subset.var = NULL,
  subset.lvl = NULL,
  subset.genes = NULL,
  use.weights = FALSE,
  run.lm = FALSE,
  run.lme = FALSE,
  run.lmerel = FALSE,
  run.contrast = FALSE,
  contrast.var = NULL,
  p.method = NULL
)
| dat | EList object output by voom( ). Must contain counts (dat$E) and meta (dat$targets). Optionally also contains gene metadata (dat$genes) and weights (dat$weights) | 
| kin | Matrix with pairwise kinship values between individuals. Must be numeric with rownames. | 
| patientID | Character of variable name to match dat$targets to kinship row and column names. | 
| libraryID | Character of variable name to match dat$targets to dat$E colnames | 
| counts | Matrix of normalized expression. Rows are genes, columns are libraries. | 
| meta | Matrix or data frame of sample and individual metadata. | 
| genes | Optional matrix or data frame of gene metadata. | 
| weights | Optional matrix of data frame of gene specific weights. Usually calculated with limma::voomWithQualityWeights(). | 
| subset_var | Character list of variable name(s) to filter data by. | 
| subset_lvl | Character list of variable value(s) or level(s) to filter data to. Must match order of subset_var | 
| subset_genes | Character vector of genes to include in models. | 
| model | Character vector of model starting with ~ Should include (1|patientID) if mixed effects will be run | 
| use_weights | Logical if gene specific weights should be used in model. Default is FALSE | 
| run_lm | Logical if should run lm model without kinship | 
| run_lme | Logical if should run lme model without kinship | 
| run_lmerel | Logical if should run lmerel model with kinship | 
| metrics | Logical if should calculate model fit metrics such as AIC, BIC, R-squared. Default is FALSE | 
| run_contrast | Logical if should run pairwise contrasts. If no matrix provided, all possible pairwise comparisons are completed. | 
| contrast_var | Character vector of variable in model to run contrasts of. Interaction terms must be specified as "var1:var2". If NULL (default), all contrasts for all variables in the model are run | 
| processors | Numeric processors to run in parallel. Default is 2 less than the total available | 
| p_method | Character of FDR adjustment method. Values as in p.adjust( ) | 
| genotype_name | Character string. Used internally for kmFit_eQTL | 
| run.lmekin | Deprecated. Please use run_lmerel | 
| subset.var | Deprecated form of subset_var | 
| subset.lvl | Deprecated form of subset_lvl | 
| subset.genes | Deprecated form of subset_genes | 
| use.weights | Deprecated form of use_weights | 
| run.lm | Deprecated form of run_lm | 
| run.lme | Deprecated form of run_lme | 
| run.lmerel | Deprecated form of run_lmerel | 
| run.contrast | Deprecated form of run_contrast | 
| contrast.var | Deprecated form of contrast_var | 
| p.method | Deprecated form of p_method | 
List of data frames including - lm/lme/lmerel: model estimates and significance - *.contrast: model estimates and significance for pairwise contrasts with variables in the original model - *.fit: model fit metrics such as sigma, AIC, BIC, R-squared (optional with metrics paramater) - *.error: error messages for genes that failed model fitting
# All samples and all genes
## Not run
# kmFit(dat = example.voom,
#     kin = example.kin, run_lmerel = TRUE,
#     model = "~ virus + (1|ptID)")
# Subset samples and genes
## Also with weights
kmFit(dat = example.voom,
      run_lm = TRUE, use_weights = FALSE,
      subset_var = list("asthma"), subset_lvl = list(c("asthma")),
      subset_genes = c("ENSG00000250479","ENSG00000250510","ENSG00000255823"),
      model = "~ virus + (1|ptID)")
# Pairwise contrasts
## Continuous interaction
kmFit(dat = example.voom,
      run_lme = TRUE, run_contrast = TRUE,
      subset_genes = c("ENSG00000250479","ENSG00000250510","ENSG00000255823"),
      model = "~ virus + asthma * median_cv_coverage + (1|ptID)",
      contrast_var=c("asthma:median_cv_coverage"))
## Categorical interaction
kmFit(dat = example.voom, kin = example.kin,
      run_lmerel = TRUE, run_contrast = TRUE, metrics=TRUE,
      subset_genes = c("ENSG00000250479","ENSG00000250510","ENSG00000255823"),
      model = "~ virus*asthma + (1|ptID)",
      contrast_var=c("virus:asthma"))
# Model with failed genes
kmFit(dat = example.voom,
      kin = example.kin, run_lmerel = TRUE, run_lm = TRUE,
      subset_genes = c("ENSG00000250479","ENSG00000250510","ENSG00000255823"),
      model = "~ virus*asthma + lib.size + norm.factors + median_cv_coverage + ptID + (1|ptID)")
# Non-dat data
kmFit(counts = example.voom$E, meta = example.voom$targets,
      run_lm = TRUE, use_weights = FALSE,
      subset_genes = c("ENSG00000250479","ENSG00000250510","ENSG00000255823"),
      model = "~ virus + (1|ptID)")
# Three level variable
example.voom$targets$lvl <- rep(c("A","B","C"), length(example.voom$targets$libID)/3)
kmFit(dat = example.voom,
      run_lme= TRUE, run_contrast = TRUE,
      subset_genes = c("ENSG00000250479","ENSG00000250510","ENSG00000255823"),
      model = "~ lvl + (1|ptID)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.