### Install and Load psupertime Source: https://github.com/wmacnair/psupertime/blob/master/README.md Use devtools to install the development version of the package from GitHub and load it into the R environment. ```R devtools::install_github('wmacnair/psupertime', build_vignettes=TRUE) library('psupertime') ``` -------------------------------- ### Browse psupertime Vignettes Source: https://github.com/wmacnair/psupertime/blob/master/README.md Access the included vignettes to explore basic functionality and examples using the provided small dataset. ```R browseVignettes(package = 'psupertime') ``` -------------------------------- ### Access psupertime package documentation Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Command to open the full help documentation for the psupertime package within R. ```R ?psupertime ``` -------------------------------- ### project_onto_psupertime(psuper_obj, new_x = NULL, new_y = NULL, process = FALSE) Source: https://github.com/wmacnair/psupertime/blob/master/man/project_onto_psupertime.Rd Projects input data onto a psupertime object. If new data is provided, it uses that; otherwise, it uses the original data associated with the object. ```APIDOC ## project_onto_psupertime ### Description Gives projection of data onto psupertime (either using original data, or new data). ### Parameters - **psuper_obj** (Psupertime object) - Required - The output object from the psupertime function. - **new_x** (matrix/data.frame) - Optional - New data to project. - **new_y** (vector) - Optional - New labels corresponding to the new data. - **process** (boolean) - Optional - Whether to process the data. ### Returns - **data.table** - A data table containing the projection and associated labels. ``` -------------------------------- ### Adjust psupertime performance and regularization settings Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Shows how to toggle between '1se' and 'best' penalization settings and change the performance scoring metric. ```R # run psupertime with different settings psuper_1se = psupertime(acinar_hvg_sce, y, sel_genes='all', penalization='1se') psuper_best = psupertime(acinar_hvg_sce, y, sel_genes='all', penalization='best') psuper_acc = psupertime(acinar_hvg_sce, y, sel_genes='all', score='class_error') # display results psuper_1se psuper_best psuper_acc ``` -------------------------------- ### Configure gene selection methods for psupertime Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Demonstrates various ways to select genes for psupertime analysis, ranging from default highly variable genes to user-defined gene lists. ```R # Option 1 (default): Select highly variable genes, using default settings for `scran`. psuper_hvg = psupertime(acinar_hvg_sce, y) psuper_hvg = psupertime(acinar_hvg_sce, y, sel_genes='hvg') # Option 2: Select highly variable genes, using your own settings. psuper_hvg_custom1 = psupertime(acinar_hvg_sce, y, sel_genes=list(hvg_cutoff=0.1, bio_cutoff=0.5)) psuper_hvg_custom2 = psupertime(acinar_hvg_sce, y, sel_genes=list(hvg_cutoff=0.1, bio_cutoff=0.5, span=0.1)) # Option 3: Use all genes psuper_all = psupertime(acinar_hvg_sce, y, sel_genes='all') # Option 4: Use transcription factors psuper_tf = psupertime(acinar_hvg_sce, y, sel_genes='tf_human') # Option 5: Use user-defined list of genes psuper_sel = psupertime( acinar_hvg_sce, y, sel_genes='list', gene_list=c('ITM2A', 'CLU', 'HSPH1', 'ADH1C', 'AMY2B') ) ``` -------------------------------- ### double_psupertime(psuper_1, psuper_2, run_names = NULL, process = FALSE) Source: https://github.com/wmacnair/psupertime/blob/master/man/double_psupertime.Rd Projects two different psupertimes onto each other. ```APIDOC ## double_psupertime ### Description Projects two different psupertimes onto each other. ### Usage double_psupertime(psuper_1, psuper_2, run_names = NULL, process = FALSE) ### Arguments - **psuper_1, psuper_2** (psupertime objects) - Two previously calculated psupertime objects. - **run_names** (Character vector) - Optional, length two, labelling the psupertime inputs. - **process** (logical) - Whether to process the projections. ### Value Returns a data.table containing projections in both directions. ``` -------------------------------- ### Run psupertime with pre-selected genes Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Load the psupertime package and a sample dataset, then execute the psupertime function using all genes. ```r # load psupertime package suppressPackageStartupMessages({ library('psupertime') library('SingleCellExperiment') }) # load the data data(acinar_hvg_sce) # run psupertime y = acinar_hvg_sce$donor_age psuper_obj = psupertime(acinar_hvg_sce, y, sel_genes='all') psuper_obj ``` -------------------------------- ### Plot labels over psupertime Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Visualizes the one-dimensional projection learned by psupertime with densities of sequential labels over pseudotime. ```r g = plot_labels_over_psupertime(psuper_obj, label_name='Donor age') (g) ``` -------------------------------- ### psupertime_plot_all(psuper_obj, output_dir = ".", tag = "", label_name = "Ordered labels", ext = "png") Source: https://github.com/wmacnair/psupertime/blob/master/man/psupertime_plot_all.Rd Generates and saves multiple plots based on the provided psupertime object. ```APIDOC ## psupertime_plot_all ### Description Convenience function to generate and save multiple plots from a psupertime object. ### Arguments - **psuper_obj** (Psupertime object) - Required - The output object from the psupertime function. - **output_dir** (string) - Optional - The directory path where the plots will be saved. Defaults to ".". - **tag** (string) - Optional - A label to be applied to all generated files. - **label_name** (string) - Optional - Description for the ordered labels in the legend (e.g., 'Developmental stage (days)'). Defaults to 'Ordered labels'. - **ext** (string) - Optional - The image format for outputs, compatible with ggsave (e.g., 'png', 'pdf', 'jpeg'). Defaults to 'png'. ``` -------------------------------- ### psupertime_go_analysis(psuper_obj, org_mapping, k = 5, sig_cutoff = 5) Source: https://github.com/wmacnair/psupertime/blob/master/man/psupertime_go_analysis.Rd Performs GO enrichment analysis for genes learned from different psupertimes. ```APIDOC ## psupertime_go_analysis ### Description Performs GO enrichment analysis for genes learned from different psupertimes. ### Parameters - **psuper_obj** (object) - Required - A previously calculated psupertime object. - **org_mapping** (string) - Required - Organism to use for annotations (e.g. 'org.Mm.eg.db', 'org.Hs.eg.db'). - **k** (integer) - Optional - Number of clusters or groups to analyze (default: 5). - **sig_cutoff** (integer) - Optional - Significance cutoff for enrichment results (default: 5). ### Returns - **data.table** - A data.table containing results of the GO enrichment analysis. ``` -------------------------------- ### psupertime_go_analysis_old(psuper_obj, org_mapping) Source: https://github.com/wmacnair/psupertime/blob/master/man/psupertime_go_analysis_old.Rd Performs GO enrichment analysis for genes learned from different psupertimes. ```APIDOC ## psupertime_go_analysis_old ### Description Performs GO enrichment analysis for genes learned from different psupertimes. ### Arguments - **psuper_obj** (object) - A previously calculated psupertime object. - **org_mapping** (string) - Organism to use for annotations (e.g. 'org.Mm.eg.db', 'org.Hs.eg.db'). ### Returns - **data.table** - A data.table containing results of GO enrichment analysis. ``` -------------------------------- ### plot_predictions_against_classes(psuper_obj, new_x = NULL, new_y = NULL, process = FALSE, plot_var = "prop_true", palette = "BuPu") Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_predictions_against_classes.Rd Plots a confusion matrix of true labels against predicted labels based on a psupertime object. ```APIDOC ## plot_predictions_against_classes ### Description Plots a confusion matrix of true labels against predicted labels. ### Arguments - **psuper_obj** (Psupertime object) - Required - The output object from the psupertime function. - **new_x, new_y** (data) - Optional - Data to predict with the psuper_obj. - **process** (boolean) - Optional - Whether to process the data. - **plot_var** (string) - Optional - The variable to plot. Options are 'prop_true' (proportion of true labels), 'prop_predict' (proportion of predicted labels), or 'N' (number of cells). - **palette** (string) - Optional - The RColorBrewer palette to use for the plot. ### Returns - **ggplot2 object** - A ggplot2 object representing the confusion matrix. ``` -------------------------------- ### plot_double_psupertime_confusion(double_obj = NULL, psuper_1 = NULL, psuper_2 = NULL, run_names = NULL, plot_var = "prop_true", palette = "BuPu") Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_double_psupertime_confusion.Rd Plots the confusion matrices of two psupertime objects against each other. This function requires either a combined double_obj or two individual psupertime objects to generate the comparison plot. ```APIDOC ## plot_double_psupertime_confusion ### Description Plots the confusion matrices of two psupertime objects against each other to visualize known versus predicted labels. ### Parameters - **double_obj** (object) - Optional - Result of applying double_psupertime to two previously calculated psupertime objects. - **psuper_1** (object) - Optional - A previously calculated psupertime object. - **psuper_2** (object) - Optional - A previously calculated psupertime object. - **run_names** (character vector) - Optional - A vector of length two, labelling the psupertime inputs. - **plot_var** (string) - Optional - The variable to plot, defaults to "prop_true". - **palette** (string) - Optional - RColorBrewer palette to use, defaults to "BuPu". ### Returns - **cowplot plot_grid** - A plot object showing known and predicted labels for each dataset and each set of predictions. ``` -------------------------------- ### psupertime(x, y, ...) Source: https://github.com/wmacnair/psupertime/blob/master/man/psupertime.Rd Performs supervised pseudotime analysis on single-cell data. ```APIDOC ## psupertime(x, y, y_labels = NULL, assay_type = "logcounts", sel_genes = "hvg", gene_list = NULL, scale = TRUE, smooth = TRUE, min_expression = 0.01, penalization = "1se", method = "proportional", score = "xentropy", n_folds = 5, test_propn = 0.1, lambdas = NULL, max_iters = 1000, seed = 1234) ### Description Performs supervised pseudotime analysis using ordinal logistic regression. It takes single-cell expression data and a vector of labels to model the progression of cells. ### Parameters - **x** (SingleCellExperiment or matrix) - Required - Input data containing genes by cells. - **y** (Vector) - Required - Vector of labels representing the intended order for training. - **y_labels** (Vector) - Optional - Alternative ordering or subset of labels in y. - **assay_type** (string) - Optional - Assay to use if x is a SingleCellExperiment object (default: "logcounts"). - **sel_genes** (string or list) - Optional - Method for gene selection (default: "hvg"). - **gene_list** (vector) - Optional - List of genes if sel_genes is set to 'list'. - **scale** (boolean) - Optional - Whether to scale expression data (default: TRUE). - **smooth** (boolean) - Optional - Whether to smooth data over neighbors (default: TRUE). - **min_expression** (numeric) - Optional - Cutoff for excluding genes (default: 0.01). - **penalization** (string) - Optional - Method for L1-penalization selection (default: "1se"). - **method** (string) - Optional - Statistical model for ordinal logistic regression (default: "proportional"). - **score** (string) - Optional - Cross-validated accuracy measure (default: "xentropy"). - **n_folds** (integer) - Optional - Number of cross-validation folds (default: 5). - **test_propn** (numeric) - Optional - Proportion of data for testing (default: 0.1). - **lambdas** (numeric vector) - Optional - User-specified sequence of lambda values. - **max_iters** (integer) - Optional - Maximum iterations for glmnet (default: 1000). - **seed** (integer) - Optional - Random seed (default: 1234). ### Returns - **psupertime object** - The resulting psupertime model object. ``` -------------------------------- ### plot_double_psupertime(double_obj = NULL, psuper_1 = NULL, psuper_2 = NULL, run_names = NULL, process = FALSE) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_double_psupertime.Rd Projects two different psupertimes onto each other and returns a ggplot object. Can be called by providing the two psupertime objects directly or by providing a pre-constructed double_psupertime object. ```APIDOC ## plot_double_psupertime ### Description Projects two different psupertimes onto each other, using points, side by side. Returns a ggplot object. ### Parameters - **double_obj** (object) - Optional - Result of applying double_psupertime to two previously calculated psupertime objects. - **psuper_1** (object) - Optional - A previously calculated psupertime object. - **psuper_2** (object) - Optional - A previously calculated psupertime object. - **run_names** (character vector) - Optional - Character vector of length two, labelling the psupertime inputs. - **process** (boolean) - Optional - Whether to process the data. ### Returns - **ggplot** - A ggplot object plotting the two psupertimes against each other. ``` -------------------------------- ### plot_new_data_over_psupertime(psuper_obj, new_x, new_y, labels, palette, process) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_new_data_over_psupertime.Rd Plots profiles of hand-selected genes against psupertime using an existing psupertime object and optional new data. ```APIDOC ## plot_new_data_over_psupertime ### Description Plots profiles of hand-selected genes against psupertime. ### Arguments - **psuper_obj** (Psupertime object) - Required - Output from psupertime. - **new_x, new_y** (Optional) - Optional - Data to predict with psuper_obj. - **labels** (vector) - Optional - Labels for the plot, default is c("Original", "New data"). - **palette** (string) - Optional - RColorBrewer palette to use, default is "BrBG". - **process** (boolean) - Optional - Whether to process the data, default is FALSE. ### Returns - **ggplot2 object** - The resulting plot object. ``` -------------------------------- ### plot_double_psupertime_contour(double_obj = NULL, psuper_1 = NULL, psuper_2 = NULL, run_names = NULL) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_double_psupertime_contour.Rd Projects two different psupertimes on top of each other. Returns a ggplot object. ```APIDOC ## plot_double_psupertime_contour ### Description Projects two different psupertimes on top of each other. See `plot_double_psupertime` for further detail. ### Parameters - **double_obj** (object) - Optional - Result of applying double_psupertime to two previously calculated psupertime objects. - **psuper_1** (object) - Optional - A previously calculated psupertime object. - **psuper_2** (object) - Optional - A previously calculated psupertime object. - **run_names** (character vector) - Optional - Character vector of length two, labelling the psupertime inputs. ### Returns - **ggplot** - A ggplot object plotting the two psupertimes against each other. ``` -------------------------------- ### Plotting using a double_psupertime object Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_double_psupertime.Rd Construct a double_psupertime object first, then pass it to the plotting function. ```R double_obj = double_psupertime(psuper_1, psuper_2) plot_double_psupertime(double_obj=double_obj) ``` -------------------------------- ### Plot psupertime training results Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Generates a diagnostic plot to evaluate the fitting process and regularization selection for a psupertime object. ```r g = plot_train_results(psuper_obj) (g) ``` -------------------------------- ### Standard psupertime function call Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd The standard way to call psupertime on a full-size dataset without pre-selection of genes. ```r ## not run # psuper_obj = psupertime(x, y) ``` -------------------------------- ### plot_identified_genes_over_psupertime(psuper_obj, label_name, n_to_plot, palette, plot_ratio) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_identified_genes_over_psupertime.Rd Plots profiles of identified genes against psupertime. ```APIDOC ## plot_identified_genes_over_psupertime ### Description Plots profiles of identified genes against psupertime. ### Parameters - **psuper_obj** (Psupertime object) - Required - Output from psupertime. - **label_name** (string) - Optional - Description for the ordered labels in the legend (default: 'Ordered labels'). - **n_to_plot** (integer) - Optional - Maximum number of genes to plot (default: 20). - **palette** (string) - Optional - RColorBrewer palette to use (default: 'RdBu'). - **plot_ratio** (numeric) - Optional - Ratio of columns to rows (default: 1.25). ### Returns - **ggplot2 object** - A ggplot2 object containing the plotted profiles. ``` -------------------------------- ### plot_specified_genes_over_psupertime(psuper_obj, extra_genes, label_name, palette, plot_ratio) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_specified_genes_over_psupertime.Rd Plots profiles of hand-selected genes against psupertime. ```APIDOC ## plot_specified_genes_over_psupertime ### Description Plots profiles of hand-selected genes against psupertime. ### Parameters - **psuper_obj** (psupertime object) - Required - Output from psupertime. - **extra_genes** (list) - Required - List of genes to be plotted (must be in the set of genes used for calculating psupertime). - **label_name** (string) - Optional - Description for the ordered labels in the legend (default: 'Ordered labels'). - **palette** (string) - Optional - RColorBrewer palette to use (default: 'RdBu'). - **plot_ratio** (numeric) - Optional - Ratio of columns to rows (default: 1.25). ### Returns - **ggplot2 object** - A ggplot2 visualization of the gene profiles. ``` -------------------------------- ### plot_labels_over_psupertime(psuper_obj, label_name = "Ordered labels", palette = "RdBu") Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_labels_over_psupertime.Rd Plots labels over their projected values on psupertime. ```APIDOC ## plot_labels_over_psupertime ### Description Plots labels over their projected values on psupertime. ### Parameters - **psuper_obj** (Psupertime object) - Required - The output object from the psupertime function. - **label_name** (string) - Optional - Description for the ordered labels in the legend (e.g., 'Developmental stage (days)'). Defaults to 'Ordered labels'. - **palette** (string) - Optional - The RColorBrewer palette to use for the plot. Defaults to 'RdBu'. ### Returns - **ggplot2 object** - A ggplot2 object representing the projected labels. ``` -------------------------------- ### Plotting two psupertime objects directly Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_double_psupertime.Rd Directly project two psupertime objects onto each other using the psuper_1 and psuper_2 arguments. ```R plot_double_psupertime(psuper_1=psuper_1, psuper_2=psuper_2) ``` -------------------------------- ### plot_go_results(go_list, sig_cutoff = 5, p_cutoff = 0.1) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_go_results.Rd Generates a bar plot of significant GO terms for each cluster. ```APIDOC ## plot_go_results ### Description Plots the significant GO terms for each cluster based on the output from a GO analysis. ### Usage plot_go_results(go_list, sig_cutoff = 5, p_cutoff = 0.1) ### Arguments - **go_list** (object) - Required - Output from GO analysis. - **sig_cutoff** (numeric) - Optional - The minimum number of annotated genes to display a GO term (default: 5). - **p_cutoff** (numeric) - Optional - The maximum p-value to display a GO term (default: 0.1). ### Returns - **bar plot** (plot) - A bar plot visualization of the significant GO terms. ``` -------------------------------- ### plot_profiles_of_gene_clusters(go_list, label_name = "Ordered labels", palette = "RdBu") Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_profiles_of_gene_clusters.Rd Generates a ggplot object representing a heatmap of gene clusters. ```APIDOC ## plot_profiles_of_gene_clusters ### Description Plots a heatmap of gene clusters using the output from a GO analysis. ### Usage plot_profiles_of_gene_clusters(go_list, label_name = "Ordered labels", palette = "RdBu") ### Parameters - **go_list** (object) - Required - The output object from a GO analysis. - **label_name** (string) - Optional - Description for the ordered labels in the legend (default: 'Ordered labels'). - **palette** (string) - Optional - The RColorBrewer palette to use for the heatmap (default: 'RdBu'). ### Returns - **ggplot object** - A ggplot object representing the gene cluster heatmap. ``` -------------------------------- ### plot_double_psupertime_genes(psuper_1, psuper_2, run_names = NULL) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_double_psupertime_genes.Rd Compares coefficients for genes learned from different psupertimes and returns a ggplot object. ```APIDOC ## plot_double_psupertime_genes ### Description Compares coefficients for genes learned from different psupertimes. ### Usage plot_double_psupertime_genes(psuper_1, psuper_2, run_names = NULL) ### Arguments - **psuper_1, psuper_2** (psupertime objects) - Required - Two previously calculated psupertime objects. - **run_names** (character vector) - Optional - Character vector of length two, labelling the psupertime inputs. ### Returns - **ggplot** - A ggplot object plotting the two sets of coefficients. ``` -------------------------------- ### plot_heatmap_of_gene_clusters(go_list) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_heatmap_of_gene_clusters.Rd Generates a ggplot heatmap object from the provided GO analysis results. ```APIDOC ## plot_heatmap_of_gene_clusters ### Description Plots a heatmap of gene clusters based on the provided GO analysis output. ### Usage plot_heatmap_of_gene_clusters(go_list) ### Arguments - **go_list** (object) - Required - The output object obtained from a GO analysis. ### Returns - **ggplot** (object) - A ggplot object representing the heatmap of gene clusters. ``` -------------------------------- ### plot_train_results(psuper_obj) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_train_results.Rd Generates a ggplot2 object visualizing the training and testing performance of the classifier. ```APIDOC ## plot_train_results ### Description Plots the results of the training process for a Psupertime object. ### Arguments - **psuper_obj** (Psupertime object) - Required - The output object from the psupertime function. ### Returns - **ggplot2 object** - A plot showing the test and training performance of the classifier. ``` -------------------------------- ### Usage of plot_new_data_over_psupertime Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_new_data_over_psupertime.Rd The function signature for plotting profiles of hand-selected genes against psupertime. ```R plot_new_data_over_psupertime( psuper_obj, new_x, new_y, labels = c("Original", "New data"), palette = "BrBG", process = FALSE ) ``` -------------------------------- ### plot_identified_gene_coefficients(psuper_obj, n = 20, abs_cutoff = 0.05) Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_identified_gene_coefficients.Rd Plots the top coefficients from a psupertime object. ```APIDOC ## plot_identified_gene_coefficients ### Description Plots the top coefficients from a psupertime object as a ggplot2 object. ### Usage plot_identified_gene_coefficients(psuper_obj, n = 20, abs_cutoff = 0.05) ### Parameters - **psuper_obj** (Psupertime object) - Required - The output object from the psupertime function. - **n** (integer) - Optional - The number of top coefficients to plot. Defaults to 20. - **abs_cutoff** (numeric) - Optional - The absolute value cutoff for coefficients. Defaults to 0.05. ### Returns - **ggplot2 object** - A plot visualizing the identified gene coefficients. ``` -------------------------------- ### Plot predictions against classes Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Generates a plot comparing predicted cell labels against known classes using the psuper_obj object. ```r g = plot_predictions_against_classes(psuper_obj) (g) ``` -------------------------------- ### plot_profiles_of_gene_clusters usage Source: https://github.com/wmacnair/psupertime/blob/master/man/plot_profiles_of_gene_clusters.Rd The function signature for plotting gene cluster profiles, requiring the output from a GO analysis. ```R plot_profiles_of_gene_clusters( go_list, label_name = "Ordered labels", palette = "RdBu" ) ``` -------------------------------- ### Plot identified genes over psupertime Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Plots z-scored log expression values of identified genes against the learned pseudotime values. ```r g = plot_identified_genes_over_psupertime(psuper_obj, label_name='Donor age') (g) ``` -------------------------------- ### Plot identified gene coefficients Source: https://github.com/wmacnair/psupertime/blob/master/vignettes/psuper_intro.Rmd Displays the top 20 genes with the largest absolute coefficient values identified by psupertime. ```r g = plot_identified_gene_coefficients(psuper_obj) (g) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.