Create an action with multiple inputs and without parameters

Hello everyone,

I would like to build an action which operates on multiple input feature tables. I found this similar thread where @thermokarst suggests using the existing merge action from feature-table plugin.

However, the idea behind my action is to build a new artifact based on the individual properties of the input tables.
I looked into original [merge](q2-feature-table/_merge.py at master · qiime2/q2-feature-table · GitHub action and it is not clear for me how multiple inputs are implemented.
Imagine if one have multiple Dataframes and want to do something like this:

!qiime supercoolnewplugin build-groups \
     --i-table atacama-table_1.qza \
     --i-table atacama-table_2.qza \
     --i-table atacama-table_n.qza \
     --o-group-array data/atacama-groups.qza

Another question, the result of this action would be a tensor, I've read the discussion of making a built-in semantic type for tensors from last year, are there any solutions for that by now or I will have to create a new semantic type?

Thank you!

2 Likes

I managed the multiple inputs, though, still not sure how it works since we [declare](q2-feature-table/_merge.py at master · qiime2/q2-feature-table · GitHub just one type of biom.Table for the input tables, but I'm not very familiar with this format if someone experienced could explain, that would be great:)

However, you can check semantic type for tensor which I created using zarr library, the code is still messy, let me know if you need an explanation, would be glad to help.

About the parameters, I will actually have to introduce one, but just for the future, would be great to know if it is possible to avoid parameter initiation and if not what's the logic behind it.

Have a good one!

Hi @Oleg !

the line you linked to is showing the function signature, which defines the view type for that function. However, the input type/format is defined in the plugin registration. See here for feature_table.merge:

this specifies the input to be a list of feature tables (the variable i_tables points to a TypeMap a few lines above. For the sake of simplicity, just imagine that this line reads inputs={'tables': List[FeatureTable[Frequency]]})

This is possible. You can see this action for an example of an action with inputs but no parameters:

I am not sure about this — I suggest following up on that other thread so that all discussion members are notified in case anyone made progress on this. cc: @ebolyen

1 Like

thank you for the explanation, Nicholas!
about tensors, I will update that thread, so others can comment on that :+1:

1 Like