# Why do the structures seem to differ between the multiqc report and usage in a notebook?

**URL:** <https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255>\
**Category:** Ask for help\
**Tags:** multiqc\
**Created:** [October 4, 2024, 11:52am UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255 "2024-10-04T11:52:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 4, 2024, 11:52am UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/1 "2024-10-04T11:52:29Z")

</div>

I have a custom table loaded:

In the MultiQC report it displays as expected

| ToL ID | Species | Class | Order |
| --- | --- | --- | --- |
| idDroMela1 | Drosophila melanogaster | Insecta | Diptera |

But when I access this via the python functions

````auto
```{python}
pprint(multiqc.get_module_data(module="dtol"))
```

````

It prints

```auto
{'idDroMela1': {'Class': 'Insecta',
                'Order': 'Diptera',
                'Species': 'Drosophila melanogaster'}}

```

and

````auto
```{python}
if "dtol" in multiqc.list_modules():
    display(multiqc.get_plot("dtol", "dtol-section").show())
```

````

prints

| | Species | Class | Order |
| --- | --- | --- | --- |
| idDroMela1 | Drosophila melanogaster | Insecta | Diptera |

---

<div class="post-metadata">

**Author:** ![ewels](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewels/32/1_2.png) [@ewels](https://community.seqera.io/u/ewels)\
**Post date:** [October 7, 2024, 1:29pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/2 "2024-10-07T13:29:37Z")

</div>

Hi @mahesh.binzerpanchal,

I don’t really understand the question sorry - what is it that you’re trying to do / that doesn’t work? It looks valid to me?

Phil

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 7, 2024, 2:55pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/3 "2024-10-07T14:55:51Z")

</div>

I want the table given by `get_module_data` to be the same as what’s given internally to MultiQC when it’s putting the table in the report. The `ToL ID` is lost on the same table.

---

<div class="post-metadata">

**Author:** ![ewels](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewels/32/1_2.png) [@ewels](https://community.seqera.io/u/ewels)\
**Post date:** [October 8, 2024, 8:26am UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/4 "2024-10-08T08:26:17Z")

</div>

The ID itself is there as the key?

```auto
{'idDroMela1':

```

You mean you want the column heading `ToL ID` to be shown?

This is part of the table config and not the module data, which is why it’s not returned.

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 8, 2024, 1:57pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/5 "2024-10-08T13:57:39Z")

</div>

Yes, I would like the heading to be displayed in the Notebook version too to be displayed. How would I go about getting that out?

---

<div class="post-metadata">

**Author:** ![ewels](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewels/32/1_2.png) [@ewels](https://community.seqera.io/u/ewels)\
**Post date:** [October 8, 2024, 11:19pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/6 "2024-10-08T23:19:49Z")

</div>

Where’s the data coming from? `dtol` isn’t a stock module… Is this custom content?

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 9, 2024, 7:04am UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/7 "2024-10-09T07:04:13Z")

</div>

Yes, it’s loaded through the config with

```auto
custom_data:
  dtol:
    file_format: "tsv"
    section_name: "DToL"
    description: "Darwin Tree of Life identifier and related meta data."
    plot_type: "table"
sp: # Search pattern
  dtol:
    fn: "DToL.tsv"

```

When the MultiQC report displays it, it displays with the “ToL ID” header, but it’s not possible it seems in a notebook to get the exact same table.

I feel like the issue is the same with the plots as well. Even though you can display plots in a notebook, they’re not as feature rich as you get in the MultiQC html.

---

<div class="post-metadata">

**Author:** ![ewels](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewels/32/1_2.png) [@ewels](https://community.seqera.io/u/ewels)\
**Post date:** [October 9, 2024, 3:22pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/8 "2024-10-09T15:22:52Z")

</div>

Everything is possible with a little config 🙂

```python
table_config = {
    "col1_header": "ToL ID"
}

```

> **[Plotting functions | Seqera Docs](https://docs.seqera.io/multiqc/development/plots#creating-a-table)**
>
> Visualising your data

I’m not entirely sure why `get_plot()` isn’t returning the table with this config though, if it is ending up in the report. I guess there is some order of logic somewhere that’s being lost…

Phil

---

<div class="post-metadata">

**Author:** ![vlad.savelyev](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/vlad.savelyev/32/576_2.png) [@vlad.savelyev](https://community.seqera.io/u/vlad.savelyev)\
**Post date:** [October 9, 2024, 3:57pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/9 "2024-10-09T15:57:31Z")

</div>

Tables in notebooks are different from plots because they are not rendered with Plotly, but rather we just wrap data in a Pandas DataFrame object and return it to the cell, so the notebook would display it with it’s intefrated widget. This, there is not going to be any of the HTML-verion rich functionality there, for now.

However, the col1 header should be possible to display as you are pointing out, so I added that in this PR:

> <https://github.com/MultiQC/MultiQC/pull/2914>
>
> Address https://community.seqera.io/t/why-do-the-structures-seem-to-differ-betwe…en-the-multiqc-report-and-usage-in-a-notebook/1255/7

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 11, 2024, 8:51am UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/10 "2024-10-11T08:51:46Z")

</div>

So, setting the config in the yaml didn’t help for the notebook case. It works for the normal multiqc report, but the pandas DataFrame object remains the same.  
Hopefully Vlad’s PR fixes that though.

It’s also a shame we don’t get the same HTML version rich functionality there. What was the decision behind that?

---

<div class="post-metadata">

**Author:** ![ewels](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ewels/32/1_2.png) [@ewels](https://community.seqera.io/u/ewels)\
**Post date:** [November 11, 2024, 12:23pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/11 "2024-11-11T12:23:31Z")

</div>

MultiQC tables use a bunch of custom javascript, which is why we didn’t package it up in the same way. In contrast, Plotly plots are generally well supported natively by notebook environments.

You can try using MultiQC tables yourself if you want, the function is `multiqc.plot.table()` - but it’s likely that we need to pull some extra magic to somehow inject in the custom CSS and JavaScript for them to function properly.

Feel free to open an issue for this on the MultiQC repo if it’s something you’d like to see.

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [November 18, 2024, 12:24pm UTC](https://community.seqera.io/t/why-do-the-structures-seem-to-differ-between-the-multiqc-report-and-usage-in-a-notebook/1255/12 "2024-11-18T12:24:04Z")

</div>

Closed on November 18, 2024, 12:24pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
