robot icon indicating copy to clipboard operation
robot copied to clipboard

`robot convert` does not work for command pipelines

Open CarMoreno opened this issue 3 months ago • 3 comments

Hi all,

I'm using robot v1.9.8 for executing a command pipeline that looks like this:


robot \
      template --template sample_robot_template.tsv \
                --prefix "chebi:http://purl.obolibrary.org/obo/chebi/" \
                --prefix "chemrof:https://w3id.org/chemrof/" \
                --ontology-iri "http://purl.obolibrary.org/obo/chebi.owl" \
      annotate --link-annotation dc:license https://creativecommons.org/licenses/by/4.0/ \
                --typed-annotation dc:title "ChEBI Ontology" xsd:string \
                --typed-annotation dc:description "Chemical Entities of Biological Interest, also known as ChEBI, is a chemical database and ontology of molecular entities focused on 'small' chemical compounds, that is part of the Open Biomedical Ontologies (OBO) effort at the European Bioinformatics Institute (EBI)." xsd:string \
                --annotation oboInOwl:saved-by "chebi" \
                --annotation oboInOwl:default-namespace "chebi_ontology" \
                --annotation oboInOwl:hasOBOFormatVersion 1.2 \
                --annotation oboInOwl:date "2025-09-29" \
                --typed-annotation owl:versionInfo "123" xsd:decimal \
                --annotation rdfs:comment "ChEBI subsumes and replaces the Chemical Ontology first. This ontology was developed by Michael Ashburner and Pankaj Jaiswal. Data was cuarated by The ChEBI Curation Team. For any queries contact [email protected]" \
                --typed-annotation foaf:homepage "https://www.ebi.ac.uk/chebi" xsd:anyURI \
                --output chebi_sample.owl \
      convert --output chebi_sample.obo

The robot template that I am using is this one. The part that seems to be broken is the convert call. If you check the result, you will find something like this:

[Term]
id: CHEBI:15377
name: water
alt_id: CHEBI:10743
property_value: https://w3id.org/chemrof/charge "0" xsd:integer
property_value: https://w3id.org/chemrof/generalized_empirical_formula "H2O" xsd:string
property_value: https://w3id.org/chemrof/inchi_key_string "XLYOFNOQVPJJNP-UHFFFAOYSA-N" xsd:string
property_value: https://w3id.org/chemrof/mass "15.999" xsd:decimal
property_value: inchi:string "InChI=1S/H2O/h1H2" xsd:string
property_value: monoisotopic:mass "15.99491462" xsd:decimal
property_value: smiles:string "[H]O[H]" xsd:string
property_value: wurcs:representation "WURCS=2.0/3,3,2/[a2122h-1b_1-5_1*OCC(CCCCCC$5/8)OC(/7)O_4*OCC=^EC(CCCCCC$6/9)O(/8)OC/3=O][a2211m-1a_1-5][a2112h-1b_1-5]/1-2-3/a3-b1_a6-c1" xsd:string

However if you execute the robot convert part separately, let' say: robot convert --input=chebi_sample.owl --output=chebi_sample.obo you get the OBO file correctly:

[Term]
id: CHEBI:15377
name: water
alt_id: CHEBI:10743
property_value: chemrof:charge "0" xsd:integer
property_value: chemrof:generalized_empirical_formula "C3H7NO2" xsd:string
property_value: chemrof:inchi_key_string "QNAYBMKLOCPYGJ-UWTATZPHSA-N" xsd:string
property_value: chemrof:inchi_string "InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m1/s1" xsd:string
property_value: chemrof:mass "89.094" xsd:decimal
property_value: chemrof:monoisotopic_mass "89.04767846" xsd:decimal
property_value: chemrof:smiles_string "C[C@@H](N)C(=O)O" xsd:string

Thanks for the help!

CarMoreno avatar Sep 29 '25 15:09 CarMoreno

Please try adding --prefix "chemrof:https://w3id.org/chemrof/" as an argument to convert at the end of your chain of commands:

...
convert --prefix "chemrof:https://w3id.org/chemrof/" \
        --output chebi_sample.obo

jamesaoverton avatar Sep 29 '25 16:09 jamesaoverton

Hi @jamesaoverton I got the same bug using the --prefix option

CarMoreno avatar Sep 30 '25 07:09 CarMoreno

I agree, this looks like a bug. I would say that for now, you will have to do (as you suggest)

robot \
      template --template chebi_robot_template.tsv \
                --prefix "chebi: http://purl.obolibrary.org/obo/chebi/" \
                --prefix "chemrof: https://w3id.org/chemrof/" \
                --ontology-iri "http://purl.obolibrary.org/obo/chebi.owl" \
      annotate --link-annotation dc:license https://creativecommons.org/licenses/by/4.0/ \
				--typed-annotation dc:title "ChEBI Ontology" xsd:string \
                --typed-annotation dc:description "Chemical Entities of Biological Interest, also known as ChEBI, is a chemical database and ontology of molecular entities focused on 'small' chemical compounds, that is part of the Open Biomedical Ontologies (OBO) effort at the European Bioinformatics Institute (EBI)." xsd:string \
                --annotation oboInOwl:saved-by "chebi" \
                --annotation oboInOwl:default-namespace "chebi_ontology" \
                --annotation oboInOwl:hasOBOFormatVersion 1.2 \
                --annotation oboInOwl:date "2025-09-29" \
                --typed-annotation owl:versionInfo "123" xsd:decimal \
                --annotation rdfs:comment "ChEBI subsumes and replaces the Chemical Ontology first. This ontology was developed by Michael Ashburner and Pankaj Jaiswal. Data was cuarated by The ChEBI Curation Team. For any queries contact [email protected]" \
                --typed-annotation foaf:homepage "https://www.ebi.ac.uk/chebi" xsd:anyURI \
                --output chebi_sample.owl
	robot convert -i chebi_sample.owl \
		--prefix "chebi: http://purl.obolibrary.org/obo/chebi/" \
                --prefix "chemrof: https://w3id.org/chemrof/" \
		-f obo -o chebi_sample.owl

I agree @CarMoreno that the most likely place of issue is the convert command:

  1. CLI --prefixes argument sdo not seem to matter when declared as part of a chain
  2. Prefixes passed through from previous commands do not seem to matter what convert is part of a chain.

matentzn avatar Sep 30 '25 11:09 matentzn