update_template_dictionaries: Update Template Dictionaries

View source: R/metadata-template-dictionary.R

update_template_dictionariesR Documentation

Update Template Dictionaries

Description

This function acts as a script to update current metadata template dictionaries. The metadata template will be an Excel file with three sheets, template, dictionary, values. The template only has the required column headers and all other rows are blank. This script assumes this part exists within the Excel file. The dictionary sheet has two columns, key and description, which has all the unique keys present in the template sheet and their respective definitions. The values sheet has four columns, key, value, valueDescription, and source. The keys are limited to those present in the template sheet and values sheet contains the possible enumerated values for those keys.

Usage

update_template_dictionaries(templates, annotations, syn, directory = ".")

Arguments

templates

A vector of metadata template synIDs.

annotations

Data frame of annotation dictionary. Required to have the columns: key, description, value, valueDescription, source.

syn

Synapse client object.

directory

The directory to download and save new versions of the metadata templates to. Defaults to ".".

Value

List of Synapse file objects, one for each metadata synID.

Examples

## Not run: 
# Fake templates and annotations
temps <- c("syn111111", "syn222222")
annots <- data.frame(
  key = c("first_name", "last_name", "last_name", "age"),
  description = c(
    "A person's given name",
    "A person's family name",
    "A person's family name",
    "A person's age"
  ),
  value = c(NA, "Smith", "Robinson", NA),
  valueDescription = c(
    NA,
    "From the Smith family",
    "From the Robinson family",
    NA
  ),
  source = c(NA, "Self-defined", "Self-defined", NA)
)

# Get Synapse client object and login
synapse <- reticulate::import("synapseclient")
syn <- synapse$Synapse()
# This style of login only works with a Synapse config file
syn$Login()

update_template_dictionaries(
  templates = temp,
  annotations = annots,
  syn = syn
)

## End(Not run)

Sage-Bionetworks/dccvalidator documentation built on May 7, 2022, 10:32 a.m.