Skip to contents

This function defaults to standardizing metadata but not messing with ontologies. computeOntologyTerms is a wrapper function that defaults to compute the ontology terms for everything (except CL), but not do anything else. Either function can be used identically by adjusting the parameters. Any breaking issues will cause this function to return FALSE. And potential issues will still return TRUE but will output a warning to stderr. All messages will get returned to the log file.

Usage

updateTaxonomyMetadata(
  metadata,
  log.file.path = getwd(),
  log.file.name = "updateTaxonomyMetadata_log.txt",
  standardize.metadata = TRUE,
  compute.ontology.terms = NULL,
  compute.brain.atlas.terms = NULL,
  convert.regions.to.names = FALSE,
  compute.cl.terms = NULL,
  print.messages = FALSE
)

Arguments

metadata

A metadata table (data.frame) to be included in the obs slot of an AIT file that will follow the AIT schema

log.file.path

The directory to output the logfile of errors and warnings (if any; default getwd())

standardize.metadata

If TRUE (default) will clean up standard schema files to try and remove common errors (e.g., differences in case, trailing spaces, etc.), and converting to factors.

compute.ontology.terms

A vector with any of the following terms: "ontology_term_id" for "organism", "anatomical_region", "self_reported_sex", "self_reported_ethnicity", "assay", or "disease". By default (NULL) no terms will be computed. For any terms included, will look for that column name and will return the best fit ontology ids in a new column with "ontology_term_id" appended.

compute.brain.atlas.terms

Default (NULL) skips this step. If provided, can be one of: DHBA (developing human brain atlas), HBA (human brain atlas), or MBA (mouse brain atlas), which correspond to ontologies of the same name at https://github.com/brain-bican.

convert.regions.to.names

If full brain region names are provided in "anatomical_region", this does nothing. Otherwise, updateTaxonomyMetadata will attempt to convert brain region abbreviations to brain region names, as required to convert to UBERON and brain atlas ontologies. If TRUE, these brain region names will overwrite inputted brain region abbrevations in "anatomical_region"; otherwise these are only returned in list entries for brain region-related ontology terms (default). Note that this variable requires a value for compute.brain.atlas.terms (not NULL), as that is the ontology that it will use to try and convert between abbreviation and name.

compute.cl.terms

Default (NULL) skips this step and is strongly recommended. If a column name is provided (e.g., "subclass") will attempt to find the nearest CL term for whatever if included in that column. This will only provide reasonable results if this column includes human readable names that are similar to names found in cell ontology.

print.messages

Print messages only to a log file (FALSE; default) or also to the screen (TRUE)

Value

A list where "metadata" is the updated metadata file and there are addition list entries corresponding to any additional columns and statistics around the conversions performed in compute.ontology.terms, if any