diff --git a/DESCRIPTION b/DESCRIPTION index 734194e..be57fa0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: PICAFlow Title: PICAFlow: a complete R workflow dedicated to flow/mass cytometry data, from data pre-processing to deep and comprehensive analysis -Version: 1.0.5 +Version: 1.0.6 Authors@R: person("Paul", "Régnier", , "paul.regnier@aphp.fr", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9713-1132")) diff --git a/R/0_Preprocessing.R b/R/0_Preprocessing.R index 0165760..c4605ee 100644 --- a/R/0_Preprocessing.R +++ b/R/0_Preprocessing.R @@ -1,6 +1,7 @@ #' Check new version #' #' This function checks whether there is a new available version for `PICAFlow` in the GitHub repository. If this is the case, users are notified. +#' @param ... Useful to transfer other arguments to the function. #' #' @export @@ -67,6 +68,8 @@ setupWorkingDirectory = function() #' #' Please note that the renaming both affects the parameters of each file AND the parameters in each self-contained compensation matrix. #' +#' If needed, it is also possible to ask for the deletion of one or several channels in the dataset by specifying the word `DELETE` in the `to_desc` and `to_name` columns of the `conversionTable` table. In this case, it (or they) will simply be deleted from the samples which match with the associated pair of `from_desc` and `from_name` parameters used in the table. +#' #' @return Generated `rds` files are saved to `rds` directory. The function also returns a matrix of all unique parameters (once correctly renamed) used in the dataset. #' #' @importFrom foreach %dopar% @@ -143,6 +146,8 @@ convertToRDS = function(conversionTable = NULL) } + parametersToRemoveID = NULL + foreach::foreach(b = 1:length(currentFileParameterDescriptions)) %do% { currentDescriptionFrom = currentFileParameterDescriptions[b] currentDescriptionName = currentFileParameterNames[b] @@ -157,22 +162,37 @@ convertToRDS = function(conversionTable = NULL) rowToReplaceID = as.numeric(which(currentFileParameterDescriptions == currentDescriptionFrom)) - currentData@parameters@data[rowToReplaceID, "desc"] = paste(currentDescriptionTo, "_replaced", sep = "") - currentData@parameters@data[rowToReplaceID, "name"] = paste(currentNameTo, "_replaced", sep = "") + if(currentDescriptionTo == "DELETE" & currentNameTo == "DELETE") + { + parametersToRemoveID = c(parametersToRemoveID, rowToReplaceID) + # currentData = currentData[, -rowToReplaceID] + } else + { + currentData@parameters@data[rowToReplaceID, "desc"] = paste(currentDescriptionTo, "_replaced", sep = "") + currentData@parameters@data[rowToReplaceID, "name"] = paste(currentNameTo, "_replaced", sep = "") - colToReplaceID = as.numeric(which(colnames(currentData@exprs) == currentNameFrom)) - colnames(currentData@exprs)[colToReplaceID] = paste(currentNameTo, "_replaced", sep = "") + colToReplaceID = as.numeric(which(colnames(currentData@exprs) == currentNameFrom)) + colnames(currentData@exprs)[colToReplaceID] = paste(currentNameTo, "_replaced", sep = "") - if (length(compensationMatricesSlotName) > 0) - { - matchingCompensationNameID = which(colnames(currentData@description[compensationMatricesSlotName][[1]]) == currentNameFrom) + if (length(compensationMatricesSlotName) > 0) + { + matchingCompensationNameID = which(colnames(currentData@description[compensationMatricesSlotName][[1]]) == currentNameFrom) + + colnames(currentData@description[compensationMatricesSlotName][[1]])[matchingCompensationNameID] = paste(currentNameTo, "_replaced", sep = "") + } - colnames(currentData@description[compensationMatricesSlotName][[1]])[matchingCompensationNameID] = paste(currentNameTo, "_replaced", sep = "") } + + } } + if(is.null(parametersToRemoveID) == FALSE & length(parametersToRemoveID) > 0) + { + currentData = currentData[, -parametersToRemoveID] + } + currentData@parameters@data[, "desc"] = gsub("_replaced", "", currentData@parameters@data[, "desc"]) currentData@parameters@data[, "name"] = gsub("_replaced", "", currentData@parameters@data[, "name"]) colnames(currentData@exprs) = gsub("_replaced", "", colnames(currentData@exprs)) diff --git a/man/checkNewVersion.Rd b/man/checkNewVersion.Rd index 386e6fd..48a6e29 100644 --- a/man/checkNewVersion.Rd +++ b/man/checkNewVersion.Rd @@ -4,7 +4,10 @@ \alias{checkNewVersion} \title{Check new version} \usage{ -checkNewVersion() +checkNewVersion(...) +} +\arguments{ +\item{...}{Useful to transfer other arguments to the function.} } \description{ This function checks whether there is a new available version for \code{PICAFlow} in the GitHub repository. If this is the case, users are notified. diff --git a/man/convertToRDS.Rd b/man/convertToRDS.Rd index 99cd2d1..930ee6e 100644 --- a/man/convertToRDS.Rd +++ b/man/convertToRDS.Rd @@ -11,7 +11,9 @@ convertToRDS(conversionTable = NULL) The \code{conversionTable} table follows a pre-defined format: 4 columns in any order (\code{from_desc}, \code{to_desc}, \code{from_name} and \code{to_name}) and any given number of line, each line referring to a specific matching to be treated. For instance, if a line has the values \verb{from_desc = CXCR5 B610-ECD-A}, \verb{to_desc = CXCR5 ECD-A}, \code{from_name = FL2-A} and \code{to_name = FL11-A}, it means that any occurrence of a parameter (in any \code{rds} file) named \code{FL2-A} which also matches the description \verb{CXCR5 B610-ECD-A} will see its values respectively replaced with \code{FL11-A} and \verb{CXCR5 ECD-A}. -Please note that the renaming both affects the parameters of each file AND the parameters in each self-contained compensation matrix.} +Please note that the renaming both affects the parameters of each file AND the parameters in each self-contained compensation matrix. + +If needed, it is also possible to ask for the deletion of one or several channels in the dataset by specifying the word \code{DELETE} in the \code{to_desc} and \code{to_name} columns of the \code{conversionTable} table. In this case, it (or they) will simply be deleted from the samples which match with the associated pair of \code{from_desc} and \code{from_name} parameters used in the table.} } \value{ Generated \code{rds} files are saved to \code{rds} directory. The function also returns a matrix of all unique parameters (once correctly renamed) used in the dataset.