Skip to content

Instantly share code, notes, and snippets.

@egonw
Created March 17, 2024 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egonw/91880159f5dc2c53ba6bcc2fdc45b8c7 to your computer and use it in GitHub Desktop.
Save egonw/91880159f5dc2c53ba6bcc2fdc45b8c7 to your computer and use it in GitHub Desktop.
Script to convert https://nanocommons.github.io/specifications/nanomile/ content (somewhat cleaned up) to ERM Identifier DB content
new File("/tmp/foo.tsv").eachLine { line ->
fields = line.split('\t')
nanomileid = fields[0]
ermid = fields[1]
ermidShort = ermid.split(':')[1]
content = """---
title: "Material: ${ermidShort}"
type: ChemicalSubstance
id: ${ermidShort}
tag: ${ermid}
otherLinks:
- url: https://nanocommons.github.io/specifications/2023/WD-nanomile-20230423/
title: NanoMILE nanomaterial identifiers
date: 2023-04-23
type: report
format: html
sameAs:
- ${nanomileid}
---
This material also has the NanoMILE identifier [${nanomileid}](https://nanocommons.github.io/specifications/nanomile/)."""
ermfilename = "${ermidShort}.yml"
new File("/home/egonw/var/Projects/hub/erm-database/_data/erm/${ermfilename}").text = content
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment