Finally getting back to working on my plugin!
I’m trying to add some user-modifiable parameters to my function. For example, we have a default threshold for filtering OTUs (e.g. an OTU has to be present in 30% of samples to not be thrown out), but I’d like to let users change that if they want. How do I specify this in the plugin_setup.py
plugin.methods.register_function
call?
Here’s what I’ve tried:
plugin.methods.register_function(
function=percentile_normalize,
...
parameters={'metadata': MetadataColumn[Categorical],
'N_control_thresh': int,
'otu_thresh': float,
'zero_val': float
},
...
Right now, I’m getting this error when I try to run my plugin_setup.py
:
TypeError: Parameter 'N_control_thresh' must be a primitive QIIME type, not <class 'int'>
And looking forward: is there anything special that I need to do in the actual function definition to specify these defaults? Currently this is my approach:
def percentile_normalize(table: biom.Table,
metadata: qiime2.CategoricalMetadataColumn,
N_control_thresh: int=10,
otu_thresh: float=0.3,
zero_val: float=1e-9) -> biom.Table:
Thanks!