# q2-metnet plugin error

**URL:** https://forum.qiime2.org/t/q2-metnet-plugin-error/31390
**Category:** Library Support
**Created:** [September 12, 2024, 5:49pm UTC](https://forum.qiime2.org/t/q2-metnet-plugin-error/31390 "2024-09-12T17:49:24Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)
#### Post date: [September 19, 2024, 3:05pm UTC](https://forum.qiime2.org/t/q2-metnet-plugin-error/31390/4 "2024-09-19T15:05:15Z")

</div>

Hi @tblasco,

I am also testing this tool and I obtain the same error output. I am running this via `qiime2-amplicon-2024.5`.

This issue is that the code is written to process an ASV/OTU table that is already transposed. That is, a standard QIIME 2 table should have the samples as rows and ASVs as columns. Whereas the example test file and code expects the samples as columns and ASVs as rows. For example compare the outputs of any table from the QIIME 2 tutorials to your example test table by running the following command on your `asv_table.qza` example table from [here](https://github.com/PlanesLab/q2-metnet/tree/97d1d2e7638c13660952c7cc5aaa8be4b8905640/test) and the `dada2_table.qza` from [here](https://docs.qiime2.org/2024.5/tutorials/pd-mice/#sequence-quality-control-and-feature-table):

```auto
qiime metadata tabulate \
    --m-input-file asv_table.qza \
   --o-visualization asv_table_tab.qzv

qiime metadata tabulate \
    --m-input-file dada2_table.qza \
   --o-visualization dada2_table_tab.qzv

```

That is the [.transpose command](https://github.com/PlanesLab/q2-metnet/blob/97d1d2e7638c13660952c7cc5aaa8be4b8905640/q2_metnet/_inputFiles.py#L31) is not necessary for a standard table. Otherwise the user must run the following prior to running the analysis:

```auto
 qiime feature-table transpose \
    --i-table ./dada2_table.qz \
    --o-transposed-feature-table ./dada2_table_transposed.qza

```

Upon running this command I was able to get past the error that @annalex observed, and moved on to a new error:

```auto
Traceback (most recent call last):
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 520, in __call__
    results = self._execute_action(
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 581, in _execute_action
    results = action(**arguments)
  File "<decorator-gen-908>", line 2, in generateFeatures
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
    outputs = self._callable_executor_(
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 576, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/metnet-2023.0.1-py3.9.egg/q2_metnet/_generateFeatures.py", line 82, in generateFeatures
    PresentTaxa, newFrequency, Samples = _extractTaxaPresentAGREDA(frequency, taxa, stream, level)
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/metnet-2023.0.1-py3.9.egg/q2_metnet/_inputFiles.py", line 132, in _extractTaxaPresentAGREDA
    return _contextTaxa(frequency, taxa, reference, level)
  File "/home/SE/BMIG-6202-MSR/qiime2-amplicon-2024.5/lib/python3.9/site-packages/metnet-2023.0.1-py3.9.egg/q2_metnet/_inputFiles.py", line 46, in _contextTaxa
    if not "" == tmp[depth_level[level]]:
IndexError: list index out of range

Plugin error from metnet:

  list index out of range

See above for debug info.

```

I think this has to do with the fact that most users will have input taxonomy files that do not have a full taxonomy as does your test file. You can use RESCRIPt's `edit-taxonomy command` to help with this, see below. Or add code to `q2-metnet` to handle these cases.

I suggest that the `q2-metnet` test cases use files similar to those of the QIIME 2 tutorials for code testing, as this will be the typical format of most users. Or be very explicit, with detailed instructions, on how to format the input files for use in `q2-metnet`.

Also, looking at the `q2-metnet` code, I noticed that [correspondent\_level](https://github.com/PlanesLab/q2-metnet/blob/97d1d2e7638c13660952c7cc5aaa8be4b8905640/q2_metnet/_inputFiles.py#L10) and [depth\_level](https://github.com/PlanesLab/q2-metnet/blob/97d1d2e7638c13660952c7cc5aaa8be4b8905640/q2_metnet/_inputFiles.py#L20) dictionaries do not allow `domain`. This will be problematic for those that use GTDB, and SILVA. These databases use `domain` and not `kingdom`, so you might want to allow `d` as a possible entry, or convert `d` to `k` behind the scenes. Or suggest that the users use RESCRIPt to change `d __` to `k__ ` like so:

```auto
qiime rescript edit-taxonomy \
    --i-taxonomy ./taxonomy.qza \
    --p-search-strings 'd__' \
    --p-replacement-strings 'k__' \
    --o-edited-taxonomy ./taxonomy-edit.qza

```

You can apply `--p-use-regex` (and/or use an input file) for more complicated edits, see [here](https://forum.qiime2.org/t/processing-filtering-and-evaluating-the-silva-database-and-other-reference-sequence-data-with-rescript/15494#heading--sixteenth-header).

I hope this helps @tblasco . 🙂

---

_[View the full topic](https://forum.qiime2.org/t/q2-metnet-plugin-error/31390)._
