EBI-Metagenomics / emg-toolkit

MGnify API toolkit
https://www.ebi.ac.uk/metagenomics
Apache License 2.0
21 stars 4 forks source link

emg-toolkit as a python method #24

Closed matinnuhamunada closed 3 years ago

matinnuhamunada commented 3 years ago

Hi,

Awesome work here!

I would like to know how I can use emg-toolkit as a python method, such as:

from mg_toolkit import original_metadata
original_metadata('ERP001736')

Sorry if I missed this in the documentation.

Best regards, Matin N.

SandyRogers commented 3 years ago

Hi @matinnuhamunada You can use import the mg_toolkit helper classes and use their methods from within your python scripts like so:

from mg_toolkit.metadata import OriginalMetadata
erp001736 = OriginalMetadata('ERP001736')
erp001736.fetch_metadata()

Thanks for using the toolkit!

matinnuhamunada commented 3 years ago

Thanks a lot @SandyRogers !

It might be useful for some users to have this example in the Readme file.

SandyRogers commented 3 years ago

No problem, I've added that example now. The toolkit's internals (e.g. those class names and their argument lists) might well change over time. So, especially in your case where you're relying on that being stable, I'd suggest locking the version you're using. E.g. mg-toolkit==0.10.0 in your requirements.txt.