# Multiple input files

**URL:** https://forum.qiime2.org/t/multiple-input-files/1992
**Category:** Developer Discussion
**Tags:** plugin-development
**Created:** [November 27, 2017, 10:31pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992 "2017-11-27T22:31:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Stefan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@Stefan](https://forum.qiime2.org/u/Stefan)
#### Post date: [November 27, 2017, 10:31pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/1 "2017-11-27T22:31:24Z")

</div>

My strategy to compute a task in parallel is to chunk the multiple fasta input file into several pieces of say 100 sequences each. After all chunks have been completed, I need to merge results. Therefore, I wonder how I can specify multiple input files for a QIIME 2 plugin.  
I am looking for something like in the [metadata plugin](https://docs.qiime2.org/2017.10/plugins/available/metadata/distance-matrix/), but from looking at the code I could not figure out what the right way of use is.

I saw from the [changelog](https://forum.qiime2.org/t/qiime-2-2017-6-release-is-now-live/645) that multiple arguments for the same parameter are prohibited.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [November 27, 2017, 10:55pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/2 "2017-11-27T22:55:18Z")

</div>

Hi @Stefan! Can you provide some clarification here - are you looking to specify multiple _user_ inputs? Or are these multiple inputs some kind of intermediate data, produced by some tool as part of the internal process of your `Method`?

---

<div class="post-metadata">

### Author: ![Stefan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@Stefan](https://forum.qiime2.org/u/Stefan)
#### Post date: [November 28, 2017, 4:23pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/3 "2017-11-28T16:23:59Z")

</div>

I need to operate on multiple user inputs, i.e. artifacts. They are all of the same type.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [November 28, 2017, 5:46pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/5 "2017-11-28T17:46:08Z")

</div>

Okay! How is the user going to be chunking these data? Are you envisioning them supplying `n` pre-made chunks to this `Method`, which will then merge the data? That seems a little cumbersome, versus the user providing their data all at once and then the chunking happening internally to the qiime2 method. Do you have some example code floating around on a branch somewhere?

---

<div class="post-metadata">

### Author: ![Stefan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@Stefan](https://forum.qiime2.org/u/Stefan)
#### Post date: [November 28, 2017, 6:05pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/7 "2017-11-28T18:05:25Z")

</div>

What is already happening is that users independently run fragment insertion for several microbiome studies. If they then decide to do a meta-analysis it is not necessary to run fragment insertion on a merged biom table. Instead, to save some compute, the user could collect all his/her placement files and merge them into one, from which one unified insertion tree can be computed - as long as all individual runs used the same reference tree.

Another use case is to chunk your input to distribute it across a grid, but that is more of an edge case. (Since it is cluster specific and trivial, I don't want to add explicit support with the plugin to chunk input and execute them)

In the end, I don't have control over the number or names of the placement files a user wants to merge.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [November 28, 2017, 6:21pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/9 "2017-11-28T18:21:17Z")

</div>

Would users be able to use the existing merging methods provided in [`feature-table`](https://docs.qiime2.org/2017.10/plugins/available/feature-table/): [`merge-seq-data`](https://docs.qiime2.org/2017.10/plugins/available/feature-table/merge-seq-data/) and [`merge`](https://docs.qiime2.org/2017.10/plugins/available/feature-table/merge/)? These methods allow for merging of sequences and feature tables, respectively. We are currently [in the process](https://github.com/qiime2/qiime2/issues/328) of implementing variadic inputs, so once that lands, these merge methods would accept any number of inputs. If I am off base here please let me know!

> [@Stefan](#):
>
> Another use case is to chunk your input to distribute it across a grid, but that is more of an edge case. (Since it is cluster specific and trivial, I don’t want to add explicit support with the plugin to chunk input and execute them)

HPC environments are on our radar for the future (maybe 2018?) - we would like to expose a handful of elements within the framework itself to make this pretty straightforward for plugin devs, but it is still a bit nebulous. Stay tuned!

---

<div class="post-metadata">

### Author: ![Stefan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@Stefan](https://forum.qiime2.org/u/Stefan)
#### Post date: [November 28, 2017, 7:25pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/11 "2017-11-28T19:25:50Z")

</div>

The data I need to merge are neither feature-tables nor sample metadata, but feature specific information. Thus, I cannot use functionality from feature-table.

Some background:  
A "placement" is the internal node of a reference phylogeny (like Greengenes) for a specific nucleotide sequence, like those from DADA2 or Deblur. Those placements are thus independent of the experiment. Therefore, if the same sequence occurs in several experiments, we don't need to recompute the placement several times, because it will be always the same.

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [November 28, 2017, 7:29pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/12 "2017-11-28T19:29:32Z")

</div>

> [@Stefan](#):
>
> nor sample metadata

I just want to make sure you saw that the two methods I posted above are for merging features tables and sequences, not for merging sample metadata.

> [@Stefan](#):
>
> but feature specific information

Can these data be expressed as a taxonomy? Users could use the [`merge-taxa-data`](https://docs.qiime2.org/2017.10/plugins/available/feature-table/merge-taxa-data/) method if that was the case.

---

<div class="post-metadata">

### Author: ![Stefan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@Stefan](https://forum.qiime2.org/u/Stefan)
#### Post date: [November 28, 2017, 7:42pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/13 "2017-11-28T19:42:00Z")

</div>

No, those data cannot be expressed as a taxonomy lineage strings, because it is not sure how many fields each placement has.

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [December 1, 2017, 10:42pm UTC](https://forum.qiime2.org/t/multiple-input-files/1992/15 "2017-12-01T22:42:08Z")

</div>

Hi @Stefan,

> [@Stefan](#):
>
> The data I need to merge are neither feature-tables nor sample metadata, but feature specific information. Thus, I cannot use functionality from feature-table.

It kind of sounds to me like you have a new `FeatureData[Placement]` type (or something like that). You should be able to recycle the strategy that the other merge methods use (there aren't any privileged plugins in QIIME 2, so anything that one plugin does, any other plugin can also do).

It does sound like you might benefit on waiting for variadic inputs however, which will be supported soon. [Here's a recent forum post](https://forum.qiime2.org/t/merging-many-feature-tables/2004/3) on that.
