From 6921e84de2451f327f5a8fe6ebbc32aa936db42a Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent@modolo.fr>
Date: Fri, 26 Oct 2018 16:05:04 +0200
Subject: [PATCH] update documentation

---
 DESCRIPTION      |  5 +++--
 NAMESPACE        |  8 ++++++++
 R/anova.R        |  9 +++++----
 R/gating.R       |  1 -
 R/project.R      |  5 +++--
 man/analysis.Rd  |  6 +++++-
 man/anova_lm.Rd  | 31 +++++++++++++++++++++++++++++++
 man/anova_rlm.Rd |  4 ++--
 man/split_lm.Rd  | 21 +++++++++++++++++++++
 9 files changed, 78 insertions(+), 12 deletions(-)
 create mode 100644 man/anova_lm.Rd
 create mode 100644 man/split_lm.Rd

diff --git a/DESCRIPTION b/DESCRIPTION
index 12c2943..d1b1d8a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: criblejurkat
 Title: Analysis of FACS data for the Jurkat crible project
 Type: Package
-Version: 1.0.0
+Version: 1.1.0
 Authors@R: person("Laurent", "Modolo", email = "laurent.modolo@ens-lyon.fr",
                   role = c("aut", "cre"))
 Description: The package provides a set of function to analyse FCS files.
@@ -17,9 +17,10 @@ Imports:
   flowWorkspace (>= 3.20),
   scales (>= 0.5),
   Biobase,
+  biglm,
   methods
 License: file LICENSE
 LazyData: true
 Suggests: testthat
-RoxygenNote: 6.0.1
+RoxygenNote: 6.1.0
 BiocViews: CellBasedAssays, FlowCytometry, Software
diff --git a/NAMESPACE b/NAMESPACE
index 71f15a6..a9a258c 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,6 +1,7 @@
 # Generated by roxygen2: do not edit by hand
 
 export(analysis)
+export(anova_lm)
 export(anova_rlm)
 export(flowset2dataframe)
 export(load_annotation)
@@ -9,11 +10,15 @@ export(plot_column)
 export(plot_line)
 export(plot_well)
 export(project_name)
+export(remove_negatives)
 export(rm_debris)
 export(rm_nonfluo)
 export(rm_nonsinglets)
 export(set_analysis)
+export(split_lm)
+import(biglm)
 importFrom(Biobase,AnnotatedDataFrame)
+importFrom(Biobase,exprs)
 importFrom(MASS,boxcox)
 importFrom(MASS,psi.huber)
 importFrom(MASS,rlm)
@@ -21,12 +26,15 @@ importFrom(flowClust,flowClust)
 importFrom(flowClust,getEstimates)
 importFrom(flowClust,plot)
 importFrom(flowClust,split)
+importFrom(flowCore,colnames)
 importFrom(flowCore,exprs)
 importFrom(flowCore,pData)
 importFrom(flowCore,phenoData)
 importFrom(flowCore,read.flowSet)
 importFrom(flowCore,sampleNames)
 importFrom(flowCore,transform)
+importFrom(flowCore,transformList)
+importFrom(flowCore,truncateTransform)
 importFrom(flowWorkspace,GatingSet)
 importFrom(flowWorkspace,flowJo_biexp_trans)
 importFrom(flowWorkspace,getData)
diff --git a/R/anova.R b/R/anova.R
index e1bd4ff..38f8036 100644
--- a/R/anova.R
+++ b/R/anova.R
@@ -121,13 +121,14 @@ batch_effect <- function(data) {
 #' @param data a data.frame
 #' @param formula (default: "ratio ~ drug + batch") the formula of the model
 #' @param lower (default: TRUE) tests if "y" (the ratio) is lower than in controls
+#' @param chunk (default: 20000) size of data chunk to do the computation on
 #' @param outdir set the outdir directory to a path (default extracted from fcs)
 #' @return a data.frame
 #' @examples
 #' \dontrun{
 #' data <- anova_lm(data)
 #' }
-#' @importFrom biglm
+#' @import biglm
 #' @importFrom grDevices dev.off pdf
 #' @importFrom stats as.formula quantile
 #' @export anova_lm
@@ -154,13 +155,12 @@ anova_lm <- function(data, formula = "ratio ~ drug + batch", lower = TRUE,
 #'
 #' @param data a data.frame
 #' @param formula (default: "ratio ~ drug + batch") the formula of the model
-#' @param chunck (default: 200000) chunk size
+#' @param chunk (default: 200000) chunk size
 #' @return a data.frame
-#' @importFrom biglm biglm
+#' @import biglm
 #' @importFrom stats as.formula quantile
 #' @export split_lm
 split_lm <- function(data, formula = "ratio ~ drug + batch", chunk = 200000) {
-
   data_index <- seq_len(nrow(data))
   data_index <- sample(data_index, nrow(data))
   index_start <- 1
@@ -209,6 +209,7 @@ anova_rlm <- function(data, formula = "ratio ~ drug + batch", lower = TRUE,
   return(data)
 }
 
+#' @import biglm
 #' @importFrom stats pt
 compute_pval <- function(model, lower = TRUE) {
   model_anova <- data.frame(coef = coef(model),
diff --git a/R/gating.R b/R/gating.R
index 7c117a9..b8f2710 100644
--- a/R/gating.R
+++ b/R/gating.R
@@ -1,7 +1,6 @@
 #' remove debris from data
 #'
 #' @param fcs_data an object of class flowSet
-#' @param cluster_number (default: 2) number of cluster to look for
 #' @return an object of class flowSet
 #' @examples
 #' \dontrun{
diff --git a/R/project.R b/R/project.R
index 40e0b4b..b8f0558 100644
--- a/R/project.R
+++ b/R/project.R
@@ -38,13 +38,14 @@ set_analysis <- function(data_path = "data/", meta = F) {
 #'
 #' @param data_path path to folder containing the data sets
 #' @param rlm_model (default: TRUE) should rlm model be use or lm ?
+#' @param chunk (default: 20000) size of data chunk to do the computation on for lm
 #' @return TRUE if everythings ran correclty
 #' @examples
 #' \dontrun{
 #' analysis("data/set_test")
 #' }
 #' @export analysis
-analysis <- function(data_path = "data/", rlm_model = TRUE) {
+analysis <- function(data_path = "data/", rlm_model = TRUE, chunk = 20000) {
   if (base::file.info(data_path)$isdir) {
     set_folders <- list.dirs(data_path, full.names = F)[-1]
   } else {
@@ -102,7 +103,7 @@ analysis <- function(data_path = "data/", rlm_model = TRUE) {
               outdir = outdir_rlm)
   } else {
     data <- anova_lm(data, formula = "ratio ~ drug + batch + set",
-              outdir = outdir_rlm)
+              outdir = outdir_rlm, chunk = chunk)
   }
   for (folder in set_folders) {
     message(paste0("plotting for ", folder))
diff --git a/man/analysis.Rd b/man/analysis.Rd
index 54c189a..95642c0 100644
--- a/man/analysis.Rd
+++ b/man/analysis.Rd
@@ -4,10 +4,14 @@
 \alias{analysis}
 \title{perform all the analysis for a set of data sets}
 \usage{
-analysis(data_path = "data/")
+analysis(data_path = "data/", rlm_model = TRUE, chunk = 20000)
 }
 \arguments{
 \item{data_path}{path to folder containing the data sets}
+
+\item{rlm_model}{(default: TRUE) should rlm model be use or lm ?}
+
+\item{chunk}{(default: 20000) size of data chunk to do the computation on for lm}
 }
 \value{
 TRUE if everythings ran correclty
diff --git a/man/anova_lm.Rd b/man/anova_lm.Rd
new file mode 100644
index 0000000..e1b094a
--- /dev/null
+++ b/man/anova_lm.Rd
@@ -0,0 +1,31 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/anova.R
+\name{anova_lm}
+\alias{anova_lm}
+\title{build lm model between drugs accounting for batch effect}
+\usage{
+anova_lm(data, formula = "ratio ~ drug + batch", lower = TRUE, outdir,
+  chunk = 20000)
+}
+\arguments{
+\item{data}{a data.frame}
+
+\item{formula}{(default: "ratio ~ drug + batch") the formula of the model}
+
+\item{lower}{(default: TRUE) tests if "y" (the ratio) is lower than in controls}
+
+\item{outdir}{set the outdir directory to a path (default extracted from fcs)}
+
+\item{chunk}{(default: 20000) size of data chunk to do the computation on}
+}
+\value{
+a data.frame
+}
+\description{
+build lm model between drugs accounting for batch effect
+}
+\examples{
+\dontrun{
+data <- anova_lm(data)
+}
+}
diff --git a/man/anova_rlm.Rd b/man/anova_rlm.Rd
index 8cb5ead..d538f97 100644
--- a/man/anova_rlm.Rd
+++ b/man/anova_rlm.Rd
@@ -2,7 +2,7 @@
 % Please edit documentation in R/anova.R
 \name{anova_rlm}
 \alias{anova_rlm}
-\title{build rm model between drugs accounting for batch effect}
+\title{build rlm model between drugs accounting for batch effect}
 \usage{
 anova_rlm(data, formula = "ratio ~ drug + batch", lower = TRUE, outdir)
 }
@@ -19,7 +19,7 @@ anova_rlm(data, formula = "ratio ~ drug + batch", lower = TRUE, outdir)
 a data.frame
 }
 \description{
-build rm model between drugs accounting for batch effect
+build rlm model between drugs accounting for batch effect
 }
 \examples{
 \dontrun{
diff --git a/man/split_lm.Rd b/man/split_lm.Rd
new file mode 100644
index 0000000..5df3fe3
--- /dev/null
+++ b/man/split_lm.Rd
@@ -0,0 +1,21 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/anova.R
+\name{split_lm}
+\alias{split_lm}
+\title{split lm model by chunck with biglm}
+\usage{
+split_lm(data, formula = "ratio ~ drug + batch", chunk = 2e+05)
+}
+\arguments{
+\item{data}{a data.frame}
+
+\item{formula}{(default: "ratio ~ drug + batch") the formula of the model}
+
+\item{chunk}{(default: 200000) chunk size}
+}
+\value{
+a data.frame
+}
+\description{
+split lm model by chunck with biglm
+}
-- 
GitLab