diff --git a/README.md b/README.md index 5b55d1e..0c30822 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ usage: molstruct [-h] [--version] -f {jsonldhtml,jsonld,rdfa,microdata} [-i IDEN [-iu IUPACNAME] [-mf MOLECULARFORMULA] [-w MOLECULARWEIGHT] [-mw MONOISOTOPICMOLECULARWEIGHT] [-d DESCRIPTION] [-dd DISAMBIGUATINGDESCRIPTION] [-img IMAGE] [-an ALTERNATENAME] - [-sa SAMEAS] [-p {drugbank-open}] [-c] [-s {iri,uuid,bnode}] [-b BASE] + [-sa SAMEAS] [-p {drugbank-open} | -c] [-s {iri,uuid,bnode}] [-b BASE] [-vd VALUE_DELIMITER] [-l LIMIT] file ``` @@ -107,7 +107,7 @@ Arguments for changing the default column names ### Additional settings arguments * `-p {drugbank-open}`, `--preset {drugbank-open}` apply presets for individual CSV sources to avoid setting individual options manually ('drugbank-open' - [DrugBank CC0 Open Data dataset](https://go.drugbank.com/releases/latest#open-data)) -* `-c`, `--columns` use only columns with renamed names +* `-c`, `--columns` use only columns with renamed names; not available when using a preset * `-s {iri,uuid,bnode}`, `--subject {iri,uuid,bnode}` molecule subject type ('iri' by default) * `-b BASE`, `--base BASE` molecule subject base for 'iri' subject type ('http://example.com/molecule#entity' by default) * `-vd VALUE_DELIMITER`, `--value-delimiter VALUE_DELIMITER` value delimiter (' | ' by default) diff --git a/molstruct/__main__.py b/molstruct/__main__.py index 0577063..f4a6bf4 100644 --- a/molstruct/__main__.py +++ b/molstruct/__main__.py @@ -63,11 +63,12 @@ def main(): help="sameAs column name ('" + n.COLUMNS['sameAs'] + "' by default), URL") additional_settings = parser.add_argument_group('Additional settings arguments') - additional_settings.add_argument("-p", "--preset", choices=['drugbank-open'], - help="apply presets for individual CSV sources to avoid setting individual options manually ('drugbank-open' - DrugBank CC0 Open Data dataset)") - additional_settings.add_argument("-c", "--columns", - help="use only columns with renamed names", - action="store_true") + additional_exclusive = additional_settings.add_mutually_exclusive_group() + additional_exclusive.add_argument("-p", "--preset", choices=['drugbank-open'], + help="apply presets for individual CSV sources to avoid setting individual options manually ('drugbank-open' - DrugBank CC0 Open Data dataset)") + additional_exclusive.add_argument("-c", "--columns", + help="use only columns with renamed names; not available when using a preset", + action="store_true") additional_settings.add_argument("-s", "--subject", choices=['iri', 'uuid', 'bnode'], default='iri', help="molecule subject type ('iri' by default)") additional_settings.add_argument("-b", "--base", type=str, @@ -80,12 +81,11 @@ def main(): # set presets if args.preset == 'drugbank-open': - args.value_delimiter = ' | ' - args.columns = True - args.identifier = 'CAS' - args.name = 'Common name' - args.inChIKey = 'Standard InChI Key' - args.alternateName = 'Synonyms' + n.VALUE_DELIMITER = ' | ' + n.COLUMNS['identifier'] = 'CAS' + n.COLUMNS['name'] = 'Common name' + n.COLUMNS['inChIKey'] = 'Standard InChI Key' + n.COLUMNS['alternateName'] = 'Synonyms' # replace default base molecule IRI if args.base: