ersilia-os / ersilia

The Ersilia Model Hub, a repository of AI/ML models for infectious and neglected disease research.
https://ersilia.io
GNU General Public License v3.0
189 stars 123 forks source link

🐛 Bug: Ersilia Catalog when no models are available #1072

Open GemmaTuron opened 3 months ago

GemmaTuron commented 3 months ago

Is your feature request related to a problem? Please describe.

When you try to run ersilia catalog --local but no models are available locally, instead of telling you this it outputs an error:

Traceback (most recent call last):
  File "/home/gturon/anaconda3/envs/ersilia/bin/ersilia", line 33, in <module>
    sys.exit(load_entry_point('ersilia', 'console_scripts', 'ersilia')())
  File "/home/gturon/anaconda3/envs/ersilia/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/gturon/anaconda3/envs/ersilia/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/gturon/anaconda3/envs/ersilia/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gturon/anaconda3/envs/ersilia/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gturon/anaconda3/envs/ersilia/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/gturon/github/ersilia-os/ersilia/ersilia/cli/commands/__init__.py", line 22, in wrapper
    return func(*args, **kwargs)
  File "/home/gturon/github/ersilia-os/ersilia/ersilia/cli/commands/catalog.py", line 47, in catalog
    catalog = mc.local().as_json()
AttributeError: 'NoneType' object has no attribute 'as_json'

Describe the solution you'd like.

We could add a better info - Not prioritary at all though

Describe alternatives you've considered

No response

Additional context.

No response

Adhivp commented 3 months ago

can you assign me this issue @DhanshreeA ?, I would be happy to learn and work on it

GemmaTuron commented 3 months ago

Hello @Adhivp

If you are working on the Outreachy contribution period please follow the guidelines and the tasks set out on the specific issue, we are a small community and cannot provide support outside those. Thanks for your understanding

Adhivp commented 3 months ago

It's ok , hope to see support in the future, Have a nice day

GemmaTuron commented 3 weeks ago

I am pretty sure there was an issue for that but I cannot find it now. The catalog used to provide a nice table with the Eos Identifier, Slug and model name, whereas now I only see something like:

[
    {
        "Identifier": "eos9taz"
    },
    {
        "Identifier": "eos8bhe"
    }
]

Can we go back to having the nice table? The command I am running is ersilia catalog --local

GemmaTuron commented 1 week ago

Also:

catalog --local --more

gives:

[
    {
        "Identifier": "eos6tg8",
        "Slug": "natural-product-fingerprint",
        "Title": "Natural product fingerprint"
    },
    {
        "Identifier": "eos43at",
        "Slug": "molgrad-herg",
        "Title": "Coloring molecules for hERG blockade"
    },
    {
        "Identifier": "eos9ei3",
        "Slug": "sa-score",
        "Title": "Synthetic accessibility score"
    },
    {
        "Identifier": "eos4zfy",
        "Slug": "maip-malaria",
        "Title": "MAIP: antimalarial activity prediction"
    }
]

We could have something more informative, like whether the model is from docker or not

DhanshreeA commented 2 days ago

Hey @dzumii and @Malikbadmus this issue is also an interesting one with potential for increased exposure to the Ersilia CLI. Let me know if either of you wants to take this up after your tracking tasks and before we jump into writing unit tests. :)

We have two tasks here:

I think you can both work on one of these tasks. LMK what you think!

dzumii commented 2 days ago

Yeah, interesting. I'll get started with the first task once we conclude the tracking functionality changes

Malikbadmus commented 2 days ago

I'll start working on the second task.

Malikbadmus commented 2 days ago

I am pretty sure there was an issue for that but I cannot find it now. The catalog used to provide a nice table with the Eos Identifier, Slug and model name, whereas now I only see something like:

[
    {
        "Identifier": "eos9taz"
    },
    {
        "Identifier": "eos8bhe"
    }
]

Can we go back to having the nice table? The command I am running is ersilia catalog --local

@DhanshreeA , the table format previously used to display model information when you run the catalog command was removed in the last commit, which can be found here, should we restore the table format or improve the current format by adding the additional information we are working on to the current dictionary output?

DhanshreeA commented 12 hours ago

I am pretty sure there was an issue for that but I cannot find it now. The catalog used to provide a nice table with the Eos Identifier, Slug and model name, whereas now I only see something like:

[
    {
        "Identifier": "eos9taz"
    },
    {
        "Identifier": "eos8bhe"
    }
]

Can we go back to having the nice table? The command I am running is ersilia catalog --local

@DhanshreeA , the table format previously used to display model information when you run the catalog command was removed in the last commit, which can be found here, should we restore the table format or improve the current format by adding the additional information we are working on to the current dictionary output?

Thanks @Malikbadmus this is useful.

@miquelduranfrigola requesting you to weigh in here - is there a particular reason why the use of tabulate library was removed from printing local model catalog? I see that a lot of work was done in a related issue a while back but it was removed in the commit referenced by Malik here as part of cleaning up catalog.