mapping-commons / sssom-py

Python toolkit for SSSOM mapping format
https://mapping-commons.github.io/sssom-py/index.html#
MIT License
48 stars 10 forks source link

Error with curie parsing in `sssom parse` #519

Closed ehartley closed 3 months ago

ehartley commented 3 months ago

I'm getting the error message AttributeError: 'tuple' object has no attribute 'split' when I run sssom parse using both v0.4.4 and v0.4.6 of sssom-py.

Running the command:

sssom parse -I obographs-json -m metadata.yml -C merged -F IAO:0100001 -F oboInOwl:consider obsolete.json -o reports/obsolete.sssom.tsv

results in:

Traceback (most recent call last):
  File "/usr/local/bin/sssom", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/sssom/cli.py", line 216, in parse
    parse_file(
  File "/usr/local/lib/python3.10/dist-packages/sssom/io.py", line 87, in parse_file
    mapping_predicates = extract_iris(mapping_predicate_filter, converter)
  File "/usr/local/lib/python3.10/dist-packages/sssom/io.py", line 190, in extract_iris
    if converter.is_curie(input):
  File "/usr/local/lib/python3.10/dist-packages/curies/api.py", line 1217, in is_curie
    return self.expand(s) is not None
  File "/usr/local/lib/python3.10/dist-packages/curies/api.py", line 1353, in expand
    prefix, identifier = self.parse_curie(curie)
  File "/usr/local/lib/python3.10/dist-packages/curies/api.py", line 1391, in parse_curie
    reference = Reference.from_curie(curie, sep=self.delimiter)
  File "/usr/local/lib/python3.10/dist-packages/curies/api.py", line 236, in from_curie
    prefix, identifier = curie.split(sep, 1)
AttributeError: 'tuple' object has no attribute 'split'

Note: this command runs without any errors in v0.3.41.

Sample input files

metadata.yml:

curie_map:
  orcid: https://orcid.org/
  owl: http://www.w3.org/2002/07/owl#
  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
  semapv: https://w3id.org/semapv/vocab/
  skos: http://www.w3.org/2004/02/skos/core#
  sssom: https://w3id.org/sssom/
license: https://creativecommons.org/licenses/by/4.0/
mapping_set_description: Mappings of obsolete classes to their replace by (IAO:0100001) and oboInOwl:consider terms.
mapping_set_id: obsolete_classes

obsolete.json:

{
  "graphs" : [ {
    "id" : "http://purl.obolibrary.org/obo/ro/ro-base.owl",
    "nodes" : [ {
      "id" : "http://purl.obolibrary.org/obo/HP_0000057",
      "lbl" : "obsolete Clitoromegaly",
      "type" : "CLASS",
      "meta" : {
        "basicPropertyValues" : [ {
          "pred" : "http://purl.obolibrary.org/obo/IAO_0100001",
          "val" : "HP:0008665"
        } ],
        "deprecated" : true
      }
    }, {
      "id" : "http://purl.obolibrary.org/obo/HP_0000284",
      "lbl" : "obsolete Abnormality of the ocular region",
      "type" : "CLASS",
      "meta" : {
        "basicPropertyValues" : [ {
          "pred" : "http://purl.obolibrary.org/obo/IAO_0100001",
          "val" : "HP:0000315"
        } ],
        "deprecated" : true
      }
    }, {
      "id" : "http://purl.obolibrary.org/obo/HP_0000489",
      "lbl" : "obsolete Abnormality of globe location or size",
      "type" : "CLASS",
      "meta" : {
        "basicPropertyValues" : [ {
          "pred" : "http://www.geneontology.org/formats/oboInOwl#consider",
          "val" : "HP:0100886"
        }, {
          "pred" : "http://www.geneontology.org/formats/oboInOwl#consider",
          "val" : "HP:0100887"
        } ],
        "deprecated" : true
      }
    } ]
  } ]
}