Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while converting obo file to owl #12

Open
hrshdhgd opened this issue Apr 10, 2024 · 3 comments
Open

Error while converting obo file to owl #12

hrshdhgd opened this issue Apr 10, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@hrshdhgd
Copy link

hrshdhgd commented Apr 10, 2024

I am trying to convert an obo file (ncbigene.obo) into owl format. This obo file was obtained via pyobo. Code for pyobo is irrelevant here but for the sake of reproducibility:

    from pyobo.sources.ncbigene import get_obo
    obo_file = get_obo()
    obo_file.write_obo(output_path, use_tqdm=True)

When I run the following:

    obo_doc = fastobo.load(input)
    if "default-namespace" not in obo_doc.header:
        obo_doc.header.insert(99, fastobo.header.DefaultNamespaceClause("NCBIGene"))
    if output_format == "owl":
        fastobo.dump_owl(obo_doc, output_path, format="ofn")

I get :

Traceback (most recent call last):
  ...
.../cli.py", line 100, in convert
    obo_doc = fastobo.load(input)
  File "<stdin>", line 203348962
    def: "\\Probable U2 small nuclear ribonucleoprotein B\\\\\\" []
         ^
SyntaxError: expected QuotedString

Would it be possible for fastobo to handle strings like these?

@hrshdhgd
Copy link
Author

For now this resolves it:

sed 's/def: "\\\\\(.*\)\\\\\\\\\\\\" \[\]/def: "\1" []/'  source_file.obo > new_file.obo

It was the only artifact so does not make sense for fastobo to do anything.

@althonos althonos transferred this issue from fastobo/fastobo-py Apr 11, 2024
@althonos althonos reopened this Apr 11, 2024
@althonos
Copy link
Member

Reopening this because this is an issue with the grammar, this syntax should be valid (even though the excessive amount of backslashes suggests some sort of export error).

@althonos althonos added the bug Something isn't working label Apr 11, 2024
@hrshdhgd
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants