You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/astir.R
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@
10
10
#' @param max_epochs Maximum number of epochs, for details see `Astir` documentation.
11
11
#' @param learning_rate Learning Rate.
12
12
#' @param initial_epochs initial epochs, for details see `Astir` documentation.
13
+
#' @param prefix Optional prefix for the slot name of the output.
13
14
#' @details Predict cell types using 'Astir'. This package requires the python library `astir` and `reticulate`. This function is still experimental and was not extensively tested in cyCONDOR. In one of the next release we will document it's usage in more details on a dedicated vignette.
14
15
#' For the moment if you want to know more feel free to reach out on our `Slack` channel. For more details on the different parameters refer to `Astir` documentation.
message("File was saved to ", dir, filename, ".fcs")
657
657
}
658
658
}
659
+
660
+
#' Save the results from cyCONDOR as a Single Cell Experiment Class as RDS file
661
+
#'
662
+
#' @title Export Flow Cytometry Dataset as SCE.
663
+
#' @description This function creates an object of the class Single Cell Experiment (SCE) based on the data of the flow cytometry dataset (fcd).
664
+
#' @param fcd flow cytometry data set
665
+
#' @param expr_slot expr_slot from which to take marker expression values, default is "orig".
666
+
#' @param reduction_method string specifying which dimensionality reduction method to use.
667
+
#' @param reduction_slot string specifying reduction name in reduction_method to use for visualization, e.g. "pca_orig".
668
+
#' @param cluster_slot string specifying which clustering slot to use to find variable specified in cluster_var.
669
+
#' @param cluster_var string specifying variable name in cluster_slot that identifies cell population labels to be used (e.g. clusters, metaclusters or predicted labels). Must be numeric in this function - factors are converted automatically.
670
+
#' @param save boolean indicating if the sce should be saved as RDS file.
671
+
#' @param dir string specifying the directory where the RDS file is saved. Current working directory by default.
672
+
#' @param filename string specifying the filename for the RDS file.
#' @returns The SCE plus a short message if the RDS file was saved successfully.
677
+
#'
678
+
#' @export
679
+
export_sce<-function(fcd=condor,
680
+
expr_slot="orig",
681
+
reduction_method=NULL,
682
+
reduction_slot=NULL,
683
+
cluster_slot=NULL,
684
+
cluster_var=NULL,
685
+
save=TRUE,
686
+
dir= paste0(getwd(), "/"),
687
+
filename="") {
688
+
689
+
message("This function is still experimental, if you run into any issue please let us know!")
690
+
691
+
# Extracting the expression data
692
+
exp<- as.matrix(t(fcd[["expr"]][[expr_slot]]))
693
+
694
+
# Extracting the annotation data
695
+
anno<-fcd[["anno"]][["cell_anno"]]
696
+
names(anno)[names(anno) =="sample_ID"] <-"sample_id"# required for CATALYST - .check_sce() checks if 'sample_id' (case sensitive!) is present in the SCE.
697
+
names(anno)[names(anno) =="group"] <-"condition"# also required naming for CATALYST
698
+
699
+
# Check if the colnames of exp and the rownames of anno match
700
+
if(!identical(colnames(exp), rownames(anno))){
701
+
stop("Column names of the expression matrix and rownames of the annotation matrix do not match.")
Copy file name to clipboardExpand all lines: R/data_visualization.R
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,8 @@ confusionMatrix <- function (i = NULL, j = NULL)
225
225
#' @param cluster_slot string specifying which clustering slot to use to find variable specified in cluster_var.
226
226
#' @param add_pseudotime Logical, if plot should be colored by pseudotime.
227
227
#' @param pseudotime_slot string specifying pseudotime name to use for visualization.
228
+
#' @param add_astir Logical, if plot should be colored by Astir prediction.
229
+
#' @param astir_slot string specifying astir description name to use for visualization.
228
230
#' @param param parameter to visualize in the plot, this can be either a continuous variable or a categorical one, the function will react differently accordingly.
229
231
#' @param order logical if you want to order the dots in the plot, by expression for example. This can help to find small populations of positive cells. If set to FALSE, the plotting order of the cells is randomized.
0 commit comments