Skip to content

Commit

Permalink
baseURI -> subject-base
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed Mar 29, 2021
1 parent c1ef89c commit 06b2741
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ In this case, your local directory `/home/user/input` has been mounted under `/a
[-mf MOLECULARFORMULA] [-w MOLECULARWEIGHT]
[-mw MONOISOTOPICMOLECULARWEIGHT] [-d DESCRIPTION]
[-dd DISAMBIGUATINGDESCRIPTION] [-img IMAGE] [-an ALTERNATENAME]
[-sa SAMEAS] [-p {drugbank}] [-c] [-b BASEURI] [-vd VALUE_DELIMITER]
[-sa SAMEAS] [-p {drugbank}] [-c] [-b SUBJECT_BASE] [-vd VALUE_DELIMITER]
[-l LIMIT]
file

Expand Down Expand Up @@ -135,9 +135,9 @@ Arguments for changing the default column names

* `-p {drugbank}`, `--preset {drugbank}` apply presets for individual CSV sources to avoid setting individual options manually
* `-c, --columns` use only columns with renamed names
* `-b BASEURI`, `--baseURI BASEURI` base URI of molecule ('http://example.com/molecule#' by default)
* `-b SUBJECT_BASE`, `--subject-base SUBJECT_BASE` subject base of molecule ('http://example.com/molecule#entity' by default)
* `-vd VALUE_DELIMITER`, `--value-delimiter VALUE_DELIMITER` value delimiter (' | ' by default)
* `-l LIMIT`, `--limit LIMIT` maximum number of results
* `-l LIMIT`, `--limit LIMIT` maximum number of results (unlimited by default)

Available options may vary depending on the version. To display all available options with their descriptions use ``molstruct -h``.

Expand Down
8 changes: 4 additions & 4 deletions molstruct/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ def main():
additional_settings.add_argument("-c", "--columns",
help="use only columns with renamed names",
action="store_true")
additional_settings.add_argument("-b", "--baseURI", type=str,
help="base URI of molecule ('" + n.BASE_URI_MOLECULE + "' by default)")
additional_settings.add_argument("-b", "--subject-base", type=str,
help="subject base of molecule ('" + n.SUBJECT_BASE + "' by default)")
additional_settings.add_argument("-vd", "--value-delimiter", type=str,
help="value delimiter ('" + n.VALUE_DELIMITER + "' by default)")
additional_settings.add_argument("-l", "--limit", type=int, help="maximum number of results")
additional_settings.add_argument("-l", "--limit", type=int, help="maximum number of results (unlimited by default)")

args = parser.parse_args()

Expand All @@ -87,7 +87,7 @@ def main():

# replace default base molecule URI
if args.baseURI:
n.BASE_URI_MOLECULE = args.baseURI
n.SUBJECT_BASE = args.baseURI

# replace default value delimiter
if args.value_delimiter:
Expand Down
4 changes: 2 additions & 2 deletions molstruct/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# default value delimiter
VALUE_DELIMITER = ' | '

# default base URI of molecule
BASE_URI_MOLECULE = 'http://example.com/molecule#entity'
# default subject base of molecule
SUBJECT_BASE = 'http://example.com/molecule#entity'

# column names
COLUMNS = {'identifier': 'identifier',
Expand Down
14 changes: 7 additions & 7 deletions molstruct/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def jsonld(reader, limit):
out_str += ' "@graph" : [\n'
for row in reader:
out_str += ' {\n'
out_str += ' "@id" : ' + json.dumps(n.BASE_URI_MOLECULE + str(i)) + ',\n'
out_str += ' "@id" : ' + json.dumps(n.SUBJECT_BASE + str(i)) + ',\n'
out_str += ' "@type" : "https://schema.org/MolecularEntity",\n'

for key, value in n.COLUMNS.items():
Expand Down Expand Up @@ -103,11 +103,11 @@ def rdfa(reader, limit):
</head>
<body vocab="http://schema.org/">''')
for row in reader:
print(' <div typeof="schema:MolecularEntity" about="' + html.escape(n.BASE_URI_MOLECULE + str(
print(' <div typeof="schema:MolecularEntity" about="' + html.escape(n.SUBJECT_BASE + str(
i), quote=True), end='')

if '#' in n.BASE_URI_MOLECULE:
print('" id="' + html.escape(n.BASE_URI_MOLECULE.rpartition('#')[-1] + str(i), quote=True), end='')
if '#' in n.SUBJECT_BASE:
print('" id="' + html.escape(n.SUBJECT_BASE.rpartition('#')[-1] + str(i), quote=True), end='')

print('">')

Expand Down Expand Up @@ -142,11 +142,11 @@ def microdata(reader, limit):
<body>''')
for row in reader:
print(' <div itemscope itemtype="http://schema.org/MolecularEntity" itemid="' + html.escape(
n.BASE_URI_MOLECULE + str(
n.SUBJECT_BASE + str(
i), quote=True), end='')

if '#' in n.BASE_URI_MOLECULE:
print('" id="' + html.escape(n.BASE_URI_MOLECULE.rpartition('#')[-1] + str(i), quote=True), end='')
if '#' in n.SUBJECT_BASE:
print('" id="' + html.escape(n.SUBJECT_BASE.rpartition('#')[-1] + str(i), quote=True), end='')

print('">')

Expand Down

0 comments on commit 06b2741

Please sign in to comment.