# biodb example definitions file for extensions packages, version 1.0.0

databases:
  {{dbName}}:
    name: {{dbTitle}}
    description: Write here the description of this database.
# $$$ CASE CONNTYPE COMPOUND $$$
    compound.db: true
#' $$$ CASE CONNTYPE MASS $$$
    mass.db: true
#' $$$ END_CASE CONNTYPE $$$
#' $$$ SECTION EDITABLE $$$
    editable: true
#' $$$ END_SECTION EDITABLE $$$
#' $$$ SECTION WRITABLE $$$
    writable: true
#' $$$ END_SECTION WRITABLE $$$
# $$$ CASE ENTRYTYPE CSV $$$
    entry.content.type: csv
# $$$ CASE ENTRYTYPE HTML $$$
    entry.content.type: html
# $$$ CASE ENTRYTYPE JSON $$$
    entry.content.type: json
# $$$ CASE ENTRYTYPE LIST $$$
    entry.content.type: list
# $$$ CASE ENTRYTYPE SDF $$$
    entry.content.type: sdf
# $$$ CASE ENTRYTYPE TXT $$$
    entry.content.type: txt
# $$$ CASE ENTRYTYPE XML $$$
    entry.content.type: xml
# $$$ CASE ENTRYTYPE DEFAULT $$$
    entry.content.type: txt
# $$$ END_CASE ENTRYTYPE $$$
    parsing.expr:
# $$$ CASE ENTRYTYPE CSV $$$
      accession: DB_ID
# $$$ CASE ENTRYTYPE HTML $$$
      accession:
        attr: value
        path: //input[@id='DATA']
# $$$ CASE ENTRYTYPE JSON $$$
      accession: id
# $$$ CASE ENTRYTYPE SDF $$$
      accession: NSC
      name: DTP names
# $$$ CASE ENTRYTYPE TXT $$$
      accession: ^ENTRY\s+(\S+)$
# $$$ CASE ENTRYTYPE XML $$$
      accession: substring-after(//dbns:return/dbns:accessionId,'ACCESSION:')
      name:
      - //dbns:name
      - //dbns:synonyms/dbns:data
# $$$ END_CASE ENTRYTYPE $$$
# $$$ CASE CONNTYPE MASS $$$
      # NOTE For mass spectra, the peak table cannot be parsed with expressions.
      # Specific code must be written inside the entry class for this, in the `doParseFieldsStep2()` method.
# $$$ CASE ENTRYTYPE JSON $$$
      chrom.col.id:
      - liquidChromatography
      - columnCode
      chrom.col.name:
      - liquidChromatography
      - columnName
      chrom.col.rt.max: RTmax
      chrom.col.rt.min: RTmin
      msmode: polarity
      msprecmz: parentIonMZ
# $$$ CASE ENTRYTYPE TXT $$$
      chebi.id: '^CH\$LINK: CHEBI\s+(.+)$'
      chemspider.id: '^CH\$LINK: CHEMSPIDER\s+(.+)$'
      msdev: '^AC\$INSTRUMENT: (.+)$'
      msmode: '^AC\$MASS_SPECTROMETRY: ION_MODE (.+)$'
      nb.peaks: '^PK\$NUM_PEAK: ([0-9]+)$'
# $$$ END_CASE ENTRYTYPE $$$
# $$$ CASE CONNTYPE COMPOUND $$$
# $$$ CASE ENTRYTYPE CSV $$$
      name: COMMON_NAME
      chebi.id: CHEBI_ID
      hmdb.metabolites.id: HMDBID
      exact.mass: MASS
      formula: FORMULA
# $$$ CASE ENTRYTYPE HTML $$$
      sequence: //b[starts-with(.,'Nucleotide Sequence')]/../tt
# $$$ CASE ENTRYTYPE JSON $$$
      average.mass: averageMass
      chebi.id: ChEBI
      formula: formula
      hmdb.metabolites.id: HMDB
      inchi: inChI
      inchikey: inChIKey
# $$$ CASE ENTRYTYPE SDF $$$
      inchi: Standard InChI
      inchikey: ["Standard InChIKey", "^InChIKey=(.*)$"]
      formula: Formula
      molecular.mass: Molecular Weight
      cas.id: CAS
# $$$ CASE ENTRYTYPE TXT $$$
      exact.mass: ^EXACT_MASS\s+(\S+)$
      formula: ^FORMULA\s+(\S+)$
      molecular.weight: ^MOL_WEIGHT\s+(\S+)$
# $$$ CASE ENTRYTYPE XML $$$
      mass: //dbns:mass
      monoisotopic.mass: //dbns:monoisotopicMass
      smiles: //dbns:return/dbns:smiles
      inchi: //dbns:return/dbns:inchi
      inchikey: //dbns:return/dbns:inchiKey
      formula:
      - //dbns:Formulae/dbns:source[text()='MyDatabase']/../dbns:data
      - (//dbns:Formulae/dbns:data)[1]
# $$$ END_CASE ENTRYTYPE $$$
# $$$ END_CASE CONNTYPE $$$
# $$$ CASE ENTRYTYPE XML $$$
    xml.ns:
      dbns: https://my.database.org/webservices/v1
      xsd: http://www.w3.org/2001/XMLSchema
# $$$ END_CASE ENTRYTYPE $$$
    searchable.fields:
      - name
# $$$ CASE CONNTYPE COMPOUND $$$
      - monoisotopic.mass
      - molecular.mass
      - average.mass
      - nominal.mass
# $$$ END_CASE CONNTYPE $$$
# $$$ SECTION REMOTE $$$
    remote: true
    # Length in seconds of the connection sliding window
    scheduler.t: 1
    # Number of connections allowed inside the connection sliding window
    scheduler.n: 3
    urls:
      # Base URL of the database server, where to find entry pages
      base.url: https://my.database.org/mydb/
      # Webservice URL to use to contact web services
      ws.url: https://my.database.org/webservices/mydb/3.2/
      # Add any other URL you need for the development of your connector
      # Inside your code, you can get each of these URLs with a call like the following one:
      #     .self$getPropValSlot('urls', 'ws.url')
# $$$ END_SECTION REMOTE $$$
# $$$ SECTION DOWNLOADABLE $$$
    downloadable: true
    dwnld.ext: zip
# $$$ END_SECTION DOWNLOADABLE $$$

fields:
  {{dbName}}.id:
    description: {{dbTitle}} ID
    case.insensitive: true
    forbids.duplicates: true
    type: id
    card: many
