Skip to contents

Command line interface

Install or check the command line interface.

SCDRAKE_CLI_VERSION
Matching CLI version for this package version.
install_cli() check_cli()
Install or check the command line interface scripts.

Project

Initialize or update a scdrake project.

init_project()
Initialize a new scdrake project.
update_project()
Update scdrake project files.

Config

Load or update config files

yq tool

Functions related to the yq tool.

check_yq()
Check the availability and version of the yq tool.
download_yq()
Download the binary of the yq tool (version 3.4.1).
get_yq_default_path()
Return a default download path for the yq tool's binary.
yq_merge_cmd()
Merge two YAML files using the yq tool.

Run pipeline

run_single_sample() run_integration() run_single_sample_r() run_integration_r()
Run the scdrake pipeline.
create_single_sample_dirs() create_integration_dirs()
Create a basic directory structure based on paths in config.
scdrake_make() scdrake_r_make()
Execute a scdrake's pipeline plan.

Check for scdrake dependencies

check_pandoc()
Check for pandoc's binary.
check_pkg_installed() check_qs_installed() check_future_installed() check_clustermq_installed() check_future.callr_installed() check_sc3_version() check_scdrake_packages()
Check if a package is installed and display an informative message.
check_scdrake()
Check for selected scdrake dependencies.

Get pipeline plans

Full plans of the single-sample and integration pipelines

get_single_sample_plan() get_integration_plan()
Get a drake plan for a specific analysis type.

Subplans common to the single-sample and integration pipelines

get_dimred_plots_other_vars_subplan()
Get a subplan for dimensionality reduction plots of selected variables.
get_common_subplan() get_cluster_markers_subplan() get_contrasts_subplan()
Get a drake subplan common to all pipelines.
get_clustering_graph_subplan()
Get a subplan for graph-based clustering.
get_clustering_kmeans_subplan()
Get a subplan for k-means clustering.
get_clustering_sc3_subplan()
Get a subplan for SC3 clustering.
get_clustering_subplan()
Get subplan for clustering.
get_cell_annotation_subplan()
Get a subplan for cell annotation via SingleR

Single-sample pipeline subplans

get_input_qc_subplan() get_norm_clustering_subplan()
Get a drake plan for a stage of single-sample pipeline.

Integration pipeline subplans

get_integration_subplan() get_int_clustering_subplan()
Get a drake plan for a stage of integration pipeline.

Custom plan

load_custom_plan()
Source a file returning a custom drake plan.

Download example data

download_pbmc1k() download_pbmc3k()
Download PBMC example data from 10x Genomics.

Options used by scdrake

Those functions are mostly used for individual targets within pipeline plans. They are usually named as <target_name>_fn().

Single-sample pipeline / stage 01_input_qc

empty_droplets_fn()
Calculate empty droplet statistics for each cell.
get_gene_filter()
Get a logical filter for genes not passing a ratio of cells expressing a gene and a minimum number of UMI per gene.
get_used_qc_filters_operator_desc()
Return an informative message about the used operator to join cell QC filters
sce_final_input_qc_fn()
Finalize a SingleCellExperiment object which will proceed to the 02_norm_clustering stage.
sce_history_fn()
Create a tibble with history of cell and gene filtering.
sce_history_plot_fn()
Plot history of cell and gene filtering.
sce_raw_fn()
Import scRNA-seq data.
sce_selected_fn()
Select a SingleCellExperiment object which will proceed to the 02_norm_clustering stage.
sce_valid_cells_fn()
Subset cells in a SingleCellExperiment object to non-empty ones and add corresponding statistics.

Single-sample pipeline / stage 02_norm_clustering

cc_genes_fn()
Get dataframe of cell cycle genes.
pca_phase_plots_fn()
Make dimred plots of PCA colored by cell cycle phase.
sce_cc_fn()
Assign cell cycle phase to cells.
sce_norm_fn() scran_normalization() sctransform_normalization()
Normalize counts either by scran or sctransform.
sce_norm_hvg_fn()
Find highly variable genes (HVGs).
sce_rm_doublets_fn()
Remove cell doublets from a SingleCellExperiment object.
selected_markers_plots_fn()
Make a grid of feature plots for selected genes.

Integration pipeline / stage 01_integration

get_int_method_description()
Return description for an integration method.
hvg_int_list_fn()
Get a named list of HVG data (gene IDs, fit, metadata).
hvg_plot_int_fn()
Make a HVG plot for uncorrected SingleCellExperiment object (processed by batchelor::multiBatchNorm()).
int_diagnostics_df_fn()
Compute and make integration diagnostics and plots for each integration method.
integration_methods_df_fn()
Make a tibble with integration methods and their parameters.
sce_int_clustering_df_fn()
Compute a quick graph-based clustering for each integration method.
sce_int_combine_hvgs()
Combine HVG data from a list of SingleCellExperiment objects.
sce_int_df_fn()
Perform integration of single-samples.
sce_int_dimred_df_fn()
Calculate t-SNE and UMAP for each integration method result (SingleCellExperiment object).
sce_int_dimred_plots_df_fn()
Make dimred plot for each combination of integration method, dimred method, and coloring by batch (single-sample) and cell cycle phase.
sce_int_import_fn()
Import sce_final_norm_clustering targets from drake caches.
sce_int_pca_df_fn()
Compute PCA for each integration method result (SingleCellExperiment object).
sce_int_processed_fn()
Subset each object in a list of SingleCellExperiment objects to common data and their corresponding metadata (e.g. HVGs).
sce_int_raw_snn_clustering_fn()
Perform a fast shared nearest neighbor clustering of each sample.
selected_markers_int_df_fn()
Prepare parameters for expression plots of selected markers.
selected_markers_int_plots_df_fn()
Make expression plots of selected markers.

Annotation

collapse_ensembl_multivals()
Collapse a character vector by ",".
make_gene_annotation()
Create a dataframe with annotation of SCE object's genes using an AnnotationDbi package.
with_dbi()
Load a SQL database file and run a function from the AnnotationDbi package.

Cell type annotation

cell_annotation_diagnostic_plots_files_fn()
Save cell annotation diagnostic plots to PDF files.
cell_annotation_diagnostic_plots_fn()
Generate diagnostic plots for cell annotation.
cell_annotation_fn()
Perform cell annotation via SingleR::SingleR().
cell_annotation_labels_fn()
Create a named list of cell labels returned from SingleR::SingleR().
cell_annotation_params_fn()
Load a list of cell annotation references into a tibble.

Manual annotation

calculate_metadata()
Calculate metadata for manual cell/spot annotation for heatmap visualisation.
create_signature_matrix_fn()
Create signature matrix from provided file containing names with markers.
meta_heatmap_ploting()
Manual annotation heatmap plotting
run_page_man_annotation()
Calculate and run PAGE annotation.

Cluster markers

cluster_markers_fn()
Add LFC summaries for Wilcox tests, obtained from t-test results.
cluster_markers_heatmaps_df_fn()
Create a final tibble holding parameters for cluster markers heatmaps generation.
cluster_markers_out_fn()
Create a final dataframe of cluster markers.
cluster_markers_test_params_fn() cluster_markers_plot_params_fn() cluster_markers_heatmap_params_fn()
Extract columns with certain parameters from cluster markers sources tibble.
cluster_markers_params_fn()
Load a list of cluster markers sources into a tibble.
cluster_markers_processed_fn()
Add additional summary columns of cluster markers for comparisons with other group levels.

Clustering

calc_sc3()
Run SC3 clustering for a specific k.
cells_per_cluster_table() cells_per_cluster_table()
Get a frequency table of cell-cluster assignments.
cluster_sc3_cluster_stability_plots_file_fn()
Save SC3 cluster stability plots to a single PDF.
cluster_sc3_df_fn()
Create a dataframe of SC3 clusters for a selected number of clusters.
get_pca_gene_var_pcs()
Get a number of PCs corresponding to biological variation.
get_pca_selected_pcs()
Get a final selection of number of PCs.
graph_snn_fn()
Compute shared nearest neighbors (SNN) graph.
make_kmeans_gaps_plot()
Make a plot of k-means gaps.
make_pca_selected_pcs_plot()
Make a plot showing numbers of selected PCs from all strategies.
run_graph_based_clustering()
Find clusters in SNN graph using a community detection algorithm and if possible, using a specified resolution.
run_kmeans_clustering()
Run k-means clustering for a specific k.
sce_calc_pca()
Calculate PCA of a SingleCellExperiment object.
sce_compute_dimreds()
Compute t-SNE and UMAP dimreds on a SingleCellExperiment object.

Contrasts

contrasts_fn()
Extract contrast statistics from cluster markers tests.
contrasts_heatmaps_df_fn()
Create a tibble holding contrast results and heatmap parameters.
contrasts_out_fn()
Format a tibble with contrast results.
contrasts_params_fn() contrasts_heatmap_params_fn() contrasts_plot_params_fn()
Prepare a tibble with parameters for contrasts tests.

Highly variable genes (HVGs)

get_top_hvgs()
Get top N highly variable genes (HVGs) by a specified metric.
plot_hvg()
Plot average expression vs. HVG metrics (total, bio, and technical variance) and highlight HVGs.
plot_hvg_fit()
Plot fit of a HVG metric and highlight HVGs.
sce_get_cc_genes()
Identify cell cycle-related genes by using variance explained threshold.
sce_remove_cc_genes()
Remove cell cycle-related genes from HVGs.

Markers

These functions are used in both cluster markers and contrasts stages.

add_marker_table_links()
Convert specified columns of a marker table to HTML links.
filter_markers()
Filter a dataframe with cluster markers.
generate_markers_results_section()
Generate a table with links to marker results.
marker_heatmap()
Make a heatmap of cell clusters.
marker_heatmaps_wrapper()
Make a heatmap of global or contrast markers.
marker_plot()
Make a marker plot.
markers_dimred_plots()
Make dimred plots for each marker source defined in CLUSTER_MARKERS_SOURCES (cluster_markers.yaml config) or CONTRASTS_SOURCES (contrasts.yaml config).
markers_dimred_plots_files()
Save dimred plots.
markers_for_tables()
Make a table used in HTML report of marker results.
markers_plots_files()
Make plots of top markers.
markers_plots_top()
Get a tibble of top markers extracted from each test result.
markers_table_files()
Prepare a table with markers and render a HTML report from RMarkdown template.
scran_markers()
Compute cell cluster markers.
additional_cell_data_fn()
Load additional cell data from a CSV or Rds (dataframe) file.
as_seurat()
Convert a SingleCellExperiment to Seurat object.
make_cell_groupings()
Create new cell groups based on existing ones.
cell_data_fn()
Merge all cell-related data to a single DataFrame.
cells_per_cluster_table() cells_per_cluster_table()
Get a frequency table of cell-cluster assignments.
create_seu_for_heatmaps()
Create a Seurat object used for heatmap generation.
merge_sce_metadata()
Merge metadata() of multiple SingleCellExperiment object.
sce_add_cell_data()
Add columns to colData() of a SingleCellExperiment object.
sce_add_colData()
Append new columns to colData of a SingleCellExperiment object.
sce_add_metadata()
Append data to metadata() list of a SingleCellExperiment object.
seu_add_metadata()
Append data to metadata o a Seurat object's assay.
which_genes_regex()
Get indices of genes whose annotation matches a regex.
sce_add_spatial_colData()
Append new columns with spatial relevance to colData of a SingleCellExperiment object.

Visualization

dimred_plots_cell_annotation_params_df_fn()
Make a tibble with parameters for dimred plots of cell annotation labels.
dimred_plots_clustering_fn()
Make a dimred plot for each clustering and dimred method.
dimred_plots_clustering_united_files_fn()
Put clustering dimred plots for different parameters (resolution, k) into a single PDF.
dimred_plots_from_params_df()
Make dimred plots of selected variables.
dimred_plots_other_vars_params_df_fn()
Make a tibble with parameters for dimred plots of selected variables.
highlight_points()
Highlight points belonging to certain levels.
plotReducedDim_mod()
A wrapper around scater::plotReducedDim().
plot_clustree()
Plot clustering tree.
plot_colData()
A wrapper for scater::plotColData().
plot_vln()
Make a combined violin-boxplot plot.
save_clustree()
Save a clustree plot into PDF.
save_selected_markers_plots_files()
Save plots of selected markers.
selected_markers_dimplot()
Make a grid of feature plots for selected markers.

Spatial visualization

getDistinctColors()
A helper function for asigning colors in pseudotissue visualization
plot_spat_point_layer_ggplot()
A function for pseudotissue visualization
plot_spat_visuals()
A function for visualization selected qc matrices in pseudotissue visualization
spatGenePlot2Dsce()
A function for visualization selected genes in pseudotissue visualization
visualized_spots()
A basic function for pseudotissue visualization

Misc functions

HTML

cells_per_cluster_table_collapsed_html()
Print a HTML of table collapsible by button.
format_used_functions()
Use the downlit package to generate a Markdown list of autolinked functions wrapped inside <details> tags.
generate_cell_annotation_plots_section()
Generate a section with dimred plots used in some RMarkdown files.
generate_dimred_plots_clustering_section()
Generate a section of clustering dimensionality reduction plots in an RMarkdown document.
generate_dimred_plots_section()
Generate a section with dimred plots used in some RMarkdown files.
generate_stage_report()
Render RMarkdown document for a stage of the pipeline.
create_a_link() create_img_link()
Generate a HTML link as <a></a> or in the form of image as <a><img /></a>.
md_header()
Generate a Markdown header.
render_bootstrap_table()
Render a dataframe-like object using knitr::kable() and kableExtra::kable_styling().

Text

format_shell_command() wrap_code() format_shell_commands()
Format a shell command as a Markdown codeblock.
get_random_strings()
Generate random strings compounded from alphabetical characters by default.
glue0() catg0() gluec() glue0c() catn()
Various wrappers around glue::glue() and cat().
str_comma() str_line() str_space()
Various utils for joining of text.

Utils

add_item_to_list()
Add named item (including NULL) to a list.
assert_that_()
A wrapper around assertthat::assert_that().
create_dummy_plot()
Create a blank ggplot with label.
filter_nulls()
Return list with removed NULL elements.
get_sys_env()
Read an environment variable and if needed, assign a default value.
get_tmp_dir()
Get a path to the temporary directory according to the OS.
`%&&%`
A short-circuit evaluation-like function similar to bash's && operator.
lapply_rows()
Apply a function over rows of a data.frame-like object and concatenate the results back to tibble or data.frame.
list_names_to_values()
Append names of a list of lists as values in each sublist.
lists_to_tibble()
Convert list of lists to tibble.
na_empty()
Return NA if an object is empty.
replace_list_nas_with_nulls()
Replace NAs in a list by NULLs.
replace_list_nulls()
Replace NULL items in a defined depth of a list.
save_pdf()
Save a list of plots to multipage PDF.
save_print() save_object_info()
Capture output from print() of an object.
set_rstudio_drake_cache()
Set rstudio_drake_cache option.
with_plan()
Locally change a future plan.
.apply_config_patches()
Apply YAML config patches to package-bundled configs.
.check_integration_methods()
Check for valid INTEGRATION_SOURCES parameter.
.check_marker_sources()
Check for correct structure of CLUSTER_MARKERS_SOURCES or CONTRASTS_SOURCES.
.get_dict_param()
Unlist a list of length one containing a named list.
.hereize_paths()
Using the here package, contruct paths relative to project's root directory.
.load_config_group()
Load a group of YAML config files.
.load_configs()
Load a list of YAML config files.
.paths_to_base_dir()
Construct paths relative to base directory.
.update_configs_recursive()
Recursively update local configs using a file glob *.default.yaml.
.prepare_marker_source_params() .prepare_marker_sources_params()
Prepare a tibble with parameters for cluster marker tests.
.process_pipeline_config() .process_main_config() .process_cluster_markers_config() .process_contrasts_config() .prepare_cell_annotation_sources_params() .process_integration_config() .process_int_clustering_config() .process_input_qc_config() .process_norm_clustering_config()
Config processing.
update_config_group
Update a group of configs, i.e. pipeline, single-sample, or integration.