Skip to content

Commit 1aaa190

Browse files
author
bonagurol
committed
push to v014
1 parent 8a560e6 commit 1aaa190

46 files changed

Lines changed: 393 additions & 379 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ v.014 -> Add ML classifier with CytoML
3636
-> Tested diffusion map and imporoved function
3737
-> Tested pseutodime and improved function
3838
-> Splittied functions in multiple files to make them easier to find
39+
-> Improved package documentation
40+
-> Improved package vignette
3941

R/clinical_classifier.R

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#' Train Clinical Classifier
22
#'
33
#' @title train_classifier_model
4-
#' @description train_classifier_model
5-
#' @param fcd XX
6-
#' @param input_type XX
7-
#' @param data_slot XX
8-
#' @param sample_names XX
9-
#' @param classification_variable XX
10-
#' @param family XX
11-
#' @param type1 XX
12-
#' @param type2 XX
13-
#' @param parallelCore XX
14-
#' @param reg XX
15-
#' @param seed XX
4+
#' @description This function trains a classifier for a clinical feature of the data.
5+
#' @param fcd flowframe object.
6+
#' @param input_type data to use for the calculation, e.g. "pca" (suggested option).
7+
#' @param data_slot name to use. If no prefix was added the, *orig*.
8+
#' @param sample_names Column name of the metadata table containing the file names.
9+
#' @param classification_variable Vector (same length as number of cells) with the classes to classify (e.g. ctrl/dis).
10+
#' @param family Response type. Must be one of the following: "gaussian","binomial","poisson","multinomial","cox","mgaussian".
11+
#' @param type1 Type of first level prediction. Type of prediction required. Type "link" gives the linear predictors for "binomial", "multinomial", "poisson" or "cox" models; for "gaussian" models it gives the fitted values. Type "response" gives the fitted probabilities for "binomial" or "multinomial", fitted mean for "poisson" and the fitted relative-risk for "cox"; for "gaussian" type "response" is equivalent to type "link".
12+
#' @param type2 Type of second level prediction.
13+
#' @param parallelCore Number of cores to be used.
14+
#' @param reg If elestic net regularization will be used (Default: FALSE).
15+
#' @param seed seed to be used.
1616
#' @import CytoDx
1717
#' @return train_classifier_model
1818
#'
@@ -57,13 +57,13 @@ train_classifier_model <- function(fcd,
5757
#' Predict Clinical Classifier
5858
#'
5959
#' @title predict_classifier
60-
#' @description predict_classifier
61-
#' @param fcd XX
62-
#' @param input_type XX
63-
#' @param data_slot XX
64-
#' @param sample_names XX
65-
#' @param model_object XX
66-
#' @param seed XX
60+
#' @description This function uses the model trained with *train_classifier_model* to predict new samples.
61+
#' @param fcd flowframe object.
62+
#' @param input_type data to use.
63+
#' @param data_slot name of the data slot to use.
64+
#' @param sample_names Column name of the metadata table containing the file names.
65+
#' @param model_object flowframe object with the stored classifier model.
66+
#' @param seed seed to be used for the analysis.
6767
#' @import CytoDx
6868
#' @return predict_classifier
6969
#'

R/clustering.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#' metaclustering
22
#'
33
#' @title metaclustering
4-
#' @description Assignment of a metacluster.
4+
#' @description Assignment of a metaclusters name.
55
#' @param fcd flow cytometry dataset.
66
#' @param clustering Name of the clustering to match for the metaclustering.
7-
#' @param name_col Column containing the original cluster
8-
#' @param name_out Name of the output column
7+
#' @param name_col Column containing the original cluster.
8+
#' @param name_out Name of the output column.
99
#' @param metaclusters Vector of the new clusters names, this should be of the same length of the levels of the original clustering.
1010
#' @return metaclustering
1111
#'
@@ -52,7 +52,7 @@ metaclustering <- function(fcd,
5252
#' @param k K value used for clustering.
5353
#' @param seed Seed used for the randomization steps.
5454
#' @param prefix Prefix for the output.
55-
#' @param top_PCA XX
55+
#' @param top_PCA Number of principal components to use for the analysis.
5656
#' @import Rphenograph
5757
#' @importFrom igraph membership
5858
#' @return runPhenograph
@@ -100,8 +100,8 @@ runPhenograph <- function(fcd,
100100
#' @param num_clusters number of final clusters.
101101
#' @param seed Seed used for the randomization steps.
102102
#' @param prefix Prefic for the output.
103-
#' @param ret_model XX
104-
#' @param top_PCA XX
103+
#' @param ret_model Logical: if the FlowSOM model should be kept for further visualization.
104+
#' @param top_PCA Number of principal components to use for the analysis.
105105
#' @return metaclustering
106106
#'
107107
#' @export

R/data_load_and_transform.R

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#' nfTransform
22
#'
33
#' @title nfTransform
4-
#' @description Data transformation.
5-
#' @param transTypeTable Table with the transformation parameters
6-
#' @param dataA dataA
7-
#' @param dataB dataB
4+
#' @description Data transformation, this function run within the prep_fcd wrapper.
5+
#' @param transTypeTable Table with the transformation parameters.
6+
#' @param dataA dataA.
7+
#' @param dataB dataB, same as dataA.
88
#' @return transformed flow cytometry dataset
99
#'
1010
#' @export
@@ -90,11 +90,11 @@ nfTransform <- function(transTypeTable, dataA, dataB){
9090
#' prepFcsFolderData
9191
#'
9292
#' @title prepFcsFolderData
93-
#' @description Load the .fcs files into a dataframe
94-
#' @param LoaderPATH Path to the .fcs files
95-
#' @param ceil number of cells to subset
96-
#' @param useCSV Logical, if input is .csv and not .fcs
97-
#' @param separator Separato used the flow csv files (if loading from csv)
93+
#' @description Load .fcs or .csv files into a dataframe and prepare the condor object.
94+
#' @param LoaderPATH Path to the .fcs files.
95+
#' @param ceil number of cells to subset.
96+
#' @param useCSV Logical, if input is .csv and not .fcs.
97+
#' @param separator Separator used the flow csv files (if loading from csv).
9898
#' @import flowCore
9999
#' @import reshape2
100100
#' @import dplyr
@@ -172,17 +172,17 @@ prepFcsFolderData <- function(LoaderPATH, ceil, useCSV, separator){
172172

173173
#' Read FlowJo workspace
174174
#'
175-
#' @title read_flowjo_workspace
176-
#' @description read_flowjo_workspace
177-
#' @param data_gs XX
178-
#' @param pop XX
179-
#' @param gate_list XX
180-
#' @param inverse.transform XX
181-
#' @param transformation XX
182-
#' @param remove_param XX
183-
#' @param merge_anno XX
184-
#' @param anno_table XX
185-
#' @param separator_anno XX
175+
#' @title Read FlowJo Workspace
176+
#' @description read_flowjo_workspace and prepare the condor object
177+
#' @param data_gs Gate Set object from flowWorkspace Package.
178+
#' @param pop Gate to keep for downstream analysis (default: 'root').
179+
#' @param gate_list Gate List of the FlowJo Workspace.
180+
#' @param inverse.transform Logical: if the data should be reverse transformed of kept with FlowJo transformation (default = FALSE).
181+
#' @param transformation If inverse.transform = TRUE, type of new transformation to perform (see nfTransform).
182+
#' @param remove_param Parameters to be removed from the condor object.
183+
#' @param merge_anno Logical: If sample anno should be merged to the condor object.
184+
#' @param anno_table Path to annotation table.
185+
#' @param separator_anno Separator of the .csv annotation table.
186186
#' @import flowWorkspace
187187
#' @import Biobase
188188
#' @import CytoML
@@ -294,15 +294,15 @@ prep_fjw <- function(data_gs,
294294
#' @title prep_fcd
295295
#' @description Wrapping function to prepare a flow cytometry dataset
296296
#' @param FCSpath Folder where the .fcs files are stored.
297-
#' @param ceil Number of cells to use for each file (set to a high number if you want to use all available events)
297+
#' @param ceil Number of cells to use for each file (set to a high number if you want to use all available events).
298298
#' @param useCSV Flag if the input are .csv files and not .fcs (experimental).
299299
#' @param transformation Transformation to perform.
300-
#' @param remove_param Parameters to remove from the trasfomration, "inTime" should be kept.
300+
#' @param remove_param Parameters to remove from the transformation, "inTime" should be kept.
301301
#' @param anno_table path to the annotation table file.
302302
#' @param filename_col Name of the column containing the filename matching with the .fcs files.
303303
#' @param seed seed to be used for the randomization of the events.
304-
#' @param separator_anno separator used in the annotation file
305-
#' @param separator_fc_csv separator used in the fc csv files
304+
#' @param separator_anno separator used in the annotation file.
305+
#' @param separator_fc_csv separator used in the fc csv files.
306306
#' @import readr
307307
#' @import readxl
308308
#' @import stringr

R/data_projection.R

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#' learnUMAP
22
#'
33
#' @title learnUMAP
4-
#' @description learnUMAP
5-
#' @param fcd XX
6-
#' @param input_type XX
7-
#' @param data_slot XX
8-
#' @param model XX
9-
#' @param n_epochs XX
10-
#' @param prefix XX
11-
#' @param n_threads XX
12-
#' @param seed XX
4+
#' @description Uses the model calculated with *runUMAP* to project new samples
5+
#' @param fcd flow cytometry dataset.
6+
#' @param input_type data to use for the calculation of the UMAP, e.g. "expr" or "pca".
7+
#' @param data_slot name of the PCA data slot to use to harmonize. If no prefix was added the, *orig*.
8+
#' @param model Data associated with an existing embedding.
9+
#' @param n_epochs Number of epochs to use during the optimization of the embedded coordinates. A value between 30 - 100 is a reasonable trade off between speed and thoroughness. By default, this value is set to one third the number of epochs used to build the model.
10+
#' @param prefix Prefix for the name of the dimensionality reduction.
11+
#' @param n_threads Number of threads to use, (except during stochastic gradient descent). Default is half the number of concurrent threads supported by the system.
12+
#' @param seed Seed to be used.
1313
#' @return learnUMAP
1414
#'
1515
#' @export
@@ -42,15 +42,15 @@ learnUMAP <- function(fcd,
4242
#' train_transfer_model
4343
#'
4444
#' @title train_transfer_model
45-
#' @description train_transfer_model
46-
#' @param fcd XX
47-
#' @param input_type XX
48-
#' @param data_slot XX
49-
#' @param label XX
50-
#' @param method XX
51-
#' @param tuneLength XX
52-
#' @param trControl XX
53-
#' @param seed XX
45+
#' @description Train a machine learning model to transfer cell label (this function implement the *caret* workflow)
46+
#' @param fcd flow cytometry dataset.
47+
#' @param input_type data to use for the calculation of the UMAP, e.g. "expr" or "pca".
48+
#' @param data_slot name of the PCA data slot to use to harmonize. If no prefix was added the, *orig*.
49+
#' @param label Vector with the labels to be used for the label transfer.
50+
#' @param method A string specifying which classification or regression model to use. Possible values are found using names(getModelInfo()). See http://topepo.github.io/caret/train-models-by-tag.html. A list of functions can also be passed for a custom model function. See http://topepo.github.io/caret/using-your-own-model-in-train.html for details.
51+
#' @param tuneLength An integer denoting the amount of granularity in the tuning parameter grid. By default, this argument is the number of levels for each tuning parameters that should be generated by train. If trainControl has the option search = "random", this is the maximum number of tuning parameter combinations that will be generated by the random search. (NOTE: If given, this argument must be named.)
52+
#' @param trControl A list of values that define how this function acts. See trainControl and http://topepo.github.io/caret/using-your-own-model-in-train.html. (NOTE: If given, this argument must be named.)
53+
#' @param seed Seed to be used.
5454
#' @import caret
5555
#' @import randomForest
5656
#' @return train_transfer_model
@@ -93,13 +93,13 @@ train_transfer_model <- function(fcd,
9393
#' predict_labels
9494
#'
9595
#' @title predict_labels
96-
#' @description predict_labels
97-
#' @param fcd XX
98-
#' @param input_type XX
99-
#' @param data_slot XX
100-
#' @param model_object XX
101-
#' @param label XX
102-
#' @param seed XX
96+
#' @description Uses the model generated with *train_transfer_model* to predict the labels of new samples
97+
#' @param fcd flow cytometry dataset.
98+
#' @param input_type data to use for the calculation of the UMAP, e.g. "expr" or "pca".
99+
#' @param data_slot name of the PCA data slot to use to harmonize. If no prefix was added the, *orig*.
100+
#' @param model_object Caret model to the used for the label transfer.
101+
#' @param label Label for the output column of the condor object.
102+
#' @param seed Seed to be used.
103103
#' @return predict_labels
104104
#'
105105
#' @export

0 commit comments

Comments
 (0)