# Create an action with multiple inputs and without parameters

**URL:** https://forum.qiime2.org/t/create-an-action-with-multiple-inputs-and-without-parameters/23730
**Category:** Developer Discussion
**Tags:** plugin-development
**Created:** [July 28, 2022, 1:21pm UTC](https://forum.qiime2.org/t/create-an-action-with-multiple-inputs-and-without-parameters/23730 "2022-07-28T13:21:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Oleg](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oleg/32/11727_2.png) [@Oleg](https://forum.qiime2.org/u/Oleg)
#### Post date: [July 28, 2022, 1:21pm UTC](https://forum.qiime2.org/t/create-an-action-with-multiple-inputs-and-without-parameters/23730/1 "2022-07-28T13:21:51Z")

</div>

Hello everyone,

I would like to build an action which operates on multiple input feature tables. I found this similar [thread](https://forum.qiime2.org/t/multiple-input-files/1992/7#:~:text=Would%20users%20be,merge%2Dseq%2Ddata) where @[thermokarst](https://forum.qiime2.org/u/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/q2\_feature\_table/\_merge.py at dev · qiime2/q2-feature-table · GitHub](https://github.com/qiime2/q2-feature-table/blob/master/q2_feature_table/_merge.py#:~:text=def%20merge(tables%3A%20biom.Table%2C)) 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:

```auto
!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](https://forum.qiime2.org/t/thoughts-on-differential-and-tensor-types/18210/7) 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!

---

<div class="post-metadata">

### Author: ![Oleg](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oleg/32/11727_2.png) [@Oleg](https://forum.qiime2.org/u/Oleg)
#### Post date: [July 28, 2022, 4:37pm UTC](https://forum.qiime2.org/t/create-an-action-with-multiple-inputs-and-without-parameters/23730/2 "2022-07-28T16:37:17Z")

</div>

I managed the multiple inputs, though, still not sure how it works since we [declare]([q2-feature-table/q2\_feature\_table/\_merge.py at dev · qiime2/q2-feature-table · GitHub](https://github.com/qiime2/q2-feature-table/blob/master/q2_feature_table/_merge.py#:~:text=def%20merge(tables%3A%20biom.Table%2C)) 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](https://zarr.readthedocs.io/en/stable/api/hierarchy.html) library, the [code](https://github.com/Vlasovets/q2-gglasso/blob/master/q2_gglasso/_transformer.py#:~:text=def%20_4(obj%3A%20np.ndarray)%20%2D%3E%20q2g.TensorDataDirectoryFormat%3A) 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!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [August 10, 2022, 8:13pm UTC](https://forum.qiime2.org/t/create-an-action-with-multiple-inputs-and-without-parameters/23730/3 "2022-08-10T20:13:28Z")

</div>

Hi @Oleg !

> [@Oleg](#):
>
> it is not clear for me how multiple inputs are implemented

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`:

> <https://github.com/qiime2/q2-feature-table/blob/dev/q2_feature_table/plugin_setup.py#L190>

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]]}`)

> [@Oleg](#):
>
> 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.

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

> <https://github.com/qiime2/q2-feature-table/blob/dev/q2_feature_table/plugin_setup.py#L215>

> [@Oleg](#):
>
> Another question, the result of this action would be a tensor, I've read the [discussion](https://forum.qiime2.org/t/thoughts-on-differential-and-tensor-types/18210/7) 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?

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

---

<div class="post-metadata">

### Author: ![Oleg](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oleg/32/11727_2.png) [@Oleg](https://forum.qiime2.org/u/Oleg)
#### Post date: [August 17, 2022, 9:23am UTC](https://forum.qiime2.org/t/create-an-action-with-multiple-inputs-and-without-parameters/23730/4 "2022-08-17T09:23:12Z")

</div>

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