R/Step3.R

#' assign groups and create contrast file
#' @param REVIEW2 input file, manually annotated output of Step1
#' @param REVIEW3 output file, input file with groups added
#' @param CONTRASTS output file for contrasts, serves as input for step4
#' @export
groups_and_contrasts <- function(REVIEW2, REVIEW3, CONTRASTS){

## Group names (optional if groups have manually been labeled)
  dt <- makeGroupLabels(REVIEW2)
  unique(dt[, .(GSE, Group, Node, NodeFunction, BSM, BSMDCD, BioSampName)]) # check

  ## Contrasts
  contrasts <- makeContrasts(dt)
  contrasts[]

  write.table(dt, REVIEW3, sep = "\t", row.names = F, quote = F)
  write.table(contrasts, CONTRASTS, sep = "\t", row.names = F, quote = F)
}


#' assign groups
#' @param REVIEW2 input file, manually annotated output of Step1
#' @param REVIEW3 output file, input file with groups added
#' @export
groups <- function(REVIEW2, REVIEW3){

  ## Group names (optional if groups have manually been labeled)
  dt <- makeGroupLabels(REVIEW2)
  unique(dt[, .(GSE, Group, Node, NodeFunction, BSM, BSMDCD, BioSampName)]) # check

  write.table(dt, REVIEW3, sep = "\t", row.names = F, quote = F)
}
axelmuller/geometric2 documentation built on May 25, 2019, 6:26 p.m.