View source: R/required_scripts.R
apply_CCN | R Documentation |
This **BETA** function is a wrapper for most of the other functions in the CCN library. It takes as input whatever information is available (e.g., dend, nomenclature, cell_assignment, metadata) and uses this to try and output a standard nomenclature table and other CCN outputs. Please see the "Applying CCN to an existing taxonomy: one function" vignette for examples of how to use this function to apply the CCN in various contexts.
apply_CCN(
dend = NULL,
nomenclature = NULL,
cell_assignment = NULL,
metadata = NULL,
first_label = setNames("All", 1),
taxonomy_id = paste0("CCN", format(Sys.time(), "%Y%m%d"), 0),
taxonomy_author = "Unspecified",
taxonomy_citation = "",
structure = "neocortex",
ontology_tag = NULL,
metadata_columns = c("subclass_label"),
metadata_order = NULL,
annotation_columns = rep("cell_set_preferred_alias", length(metadata_columns)),
cluster_column = "cluster_label",
append_metadata = FALSE,
ccn_filename = "nomenclature.zip",
duplicate_annotations = "cell_set_additional_aliases"
)
dend |
dendrogram of cell types to annotate. At least one of dend, nomenclature, cell_assignment, or metadata must be provided. |
nomenclature |
the nomenclature table output from 'build_nomenclature_table' or related/downstream functions. |
cell_assignment |
a named vector linking each unique cell id ('names(cell_assignment)') to their cell type assignments ('cell_assignment') |
metadata |
cell or cell type metadata table that includes the columns to annotate |
first_label |
a named vector used as prefix for cell_set_label |
taxonomy_id |
unique accession ID for the taxonomy also used to prefix the cell sets accessions. Defaults to 'CCN[YYYYMMDD]0'. If more than one is provided (not recommended), any IDs beyond the first in the character vector are saved in a "taxonomy_alias" column. |
taxonomy_author |
the name of a point person for this taxonomy |
taxonomy_citation |
permanent data identifier corresponding to the taxonomy (or default="" if none). Ideally the DOI for a relevant publication. |
structure |
the location in the brain (or body) from where the data in the taxonomy was collected |
ontology_tag |
a standard ontology term (e.g., from UBERON) for the 'structure', or "none" if unavailable. NULL (default) attempts to find one in UBERON using 'find_ontology_terms'. |
metadata_columns |
a character vector of column names corresponding to the metadata fields to add annotations. Only used if "metadata" is provided |
metadata_order |
optional character vector of column names indicating the order to include metadata. If supplied, must be the same length as "metadata_columns". Only used if "metadata" is provided |
annotation_columns |
character vector indicating which column to annotate for each metadata column supplied (default is is "cell_set_preferred_alias"). Only used if "metadata" is provided |
cluster_column |
column name in "metadata" that corresponds to values in the "cell_set_preferred_alias" column of "cell_set_information". Only used if "metadata" is provided |
append_metadata |
If TRUE, it will append info; if FALSE (default), it will skip cases where there is already an entry. Only used if "metadata" is provided |
ccn_filename |
file name for zip file with final CCN files containing the same information that is returned. Will output to current working directory unless full path is specified. Will not output anywhere if set to NULL. |
duplicate_annotations |
either NULL or a character indicating which column to append annotations if the annotation_columns column already has an entry. Only used if append=TRUE. Default "cell_set_additional_aliases" |
a list containing the three CCN standard outputs:
# Describe is optional and can go after and param or return
Final nomenclature table where rows correspond to cell sets and columns correspond to standard CCN columns.
A dendrogram updated with node numeric labels, if dend was provided. These are useful for post-hoc manual annotations but otherwise can be ignored.
A dendrogram updated with node labels and CCN annotations, if dend was provided. This is what is output in dend.json
A data frame where the first columns corresponds to each cell's unique ID (if cell_assignment or metadata is provided) and the remaining columns correspond to cell sets. Entries are either 0 = cell unassigned to cell set or 1 = cell assigned to cell set.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.