Skip to content

Instantly share code, notes, and snippets.

@bheavner
Last active June 15, 2018 18:51
Show Gist options
  • Save bheavner/47f9ca0799108c367d4fe8979a81479d to your computer and use it in GitHub Desktop.
Save bheavner/47f9ca0799108c367d4fe8979a81479d to your computer and use it in GitHub Desktop.
Example of minting a minid with the minidtools R client
# goal: mint minids for freeze 5 annotation in exchange area.
# requires digest and minidtools libraries
# computes checksum using local copy of the file
localPath <-
paste0("/projects/topmed/variant_annotation/freeze_5/database/v0/",
"parsed_files/2_snv.tsv.gz")
# use location on exchange area for the location metadata in the minid
eaPath <-
paste0("sftp://gap-upload.ncbi.nlm.nih.gov/exchange/Combined_Study_Data/",
"Genotypes/freeze.5_annotation/WGSA_parsed/provisional/2_snv.tsv.gz")
# calculate the checksum
shaHash <- digest::digest(localPath, algo = "sha256", file = TRUE)
# load minid configuration
config <- minidtools::load_configuration(
config_file = "~/.minid/minid-config.json")
# set up minid object
new_minid <- minidtools::minid()
minidtools::checksum_function(new_minid) <- "sha256"
minidtools::checksum(new_minid) <- shaHash
minidtools::titles(new_minid) <- list(list(title = "2_snv.tsv.gz"))
minidtools::locations(new_minid) <- list(list(link = eaPath))
# mint the new minid
minidtools::mint(minid = new_minid, configuration = config, test = TRUE)
# resolve the new minid to see the metadata:
minidtools::lookup("minid:b9g69w")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment