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

Listing recipe requirements from within python #91

Open
nsheff opened this issue Mar 13, 2020 · 2 comments
Open

Listing recipe requirements from within python #91

nsheff opened this issue Mar 13, 2020 · 2 comments
Projects
Milestone

Comments

@nsheff
Copy link
Contributor

nsheff commented Mar 13, 2020

I thought there might be a way to do this:

rgc.requirements("rCRSd", "bowtie2_index")

But it fails. This is because the recipes are not in the refgenconf package, so of course it can't provide a list of the requirements from the python interface. When recipes are made flexible, we should keep this in mind.

@stolarczyk stolarczyk added this to the 0.12.0 milestone Mar 11, 2021
@nsheff nsheff added this to Increased utility features in Refgenie Mar 16, 2021
@stolarczyk stolarczyk moved this from Improving usefulness: cloud and other applications to Flexible recipes in Refgenie Mar 18, 2021
@nsheff
Copy link
Contributor Author

nsheff commented Nov 2, 2021

@stolarczyk with flexible recipes, is there now a way to retrieve recipe requirements from RefGenConf?

@stolarczyk
Copy link
Contributor

yes, there are 2 dedicated properties on Recipe objcts, so you can do this now:

In [9]: rgc = RefGenConf(filepath="r.yaml")

In [10]: bt2_idx_recipe = rgc.get_recipe("bowtie2_index")

In [11]: print(bt2_idx_recipe.requirements)
bowtie2_index recipe requirements:

params:
  - threads (Number of threads to use); default: 1
assets:
  - fasta (fasta asset for genome); default: fasta

In [12]: bt2_idx_recipe.requirements_table
Out[12]: 
                          bowtie2_index recipe requirements                           
┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Type   ┃ ID      ┃ Description              ┃ Default value ┃ Argument pattern     ┃
┡━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ params │ threads │ Number of threads to use │ 1             │ --params threads=1   │
│ assets │ fasta   │ fasta asset for genome   │ fasta         │ --assets fasta=fasta │
└────────┴─────────┴──────────────────────────┴───────────────┴──────────────────────┘

There is no Recipe.requirements_dict though, which would be more elegant, but you can get it this way:

In [4]: bt2_idx_recipe.inputs
Out[4]: 
{'files': None,
 'params': {'threads': {'description': 'Number of threads to use',
   'default': 1}},
 'assets': {'fasta': {'asset_class': 'fasta',
   'description': 'fasta asset for genome',
   'default': 'fasta'}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Refgenie
Flexible recipes
Development

No branches or pull requests

2 participants