Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request MultiQC#1938 from ewels/config-table-docs
Browse files Browse the repository at this point in the history
Improve docs about customising tables from the config
  • Loading branch information
ewels authored Jun 16, 2023
2 parents 0d7d78b + 6bcea2f commit 7129bd1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
41 changes: 29 additions & 12 deletions docs/core/reports/customisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,20 +528,24 @@ custom_plot_config:
Much like with the custom plot config above, you can override almost any configuration options for tables.
To see what's available, read the documentation about [Creating a table](#creating-a-table) below.

Tables have configuration at two levels. Table-wide configs are the same as plot configs and can
be overridden with `custom_plot_config` as described above.
Tables have configuration at two levels:

Headers have their own configuration which can be overriden with `custom_table_header_config`.
1. Entire table
- Affects all columns and data. These configs are the same as _plot configs_ and can be overridden with `custom_plot_config` as described in the [Customising plots](#customising-plots) section above.
2. Specific columns
- Table columns (headers) have their own configuration scope:`custom_table_header_config`. See below.

Examples are often more useful for this kind of thing than words, so here are a few:
### Config for an entire table

For the Picard HSMetrics table, we can use a custom table header for the first column
and change the default minimum value for the colour scale for all columns:
Here we are customising the _Picard HSMetrics_ table.
We're setting a non-standard title for the first column (usually _"Sample name"_) and changing the default minimum value for the colour scale for _all_ columns.

> Here `min` is a _header_ config but we're setting it at table config level.
> This means it will be used as a default for all columns in the table if the module
> doesn't itself define anything specific for that column.
> If it does, you need to overwrite that specific column using `custom_table_header_config`
:::note
Here `min` is a _header_ config but we're setting it at _table config_ level.
This means it will be used as a default for all columns in the table if the module
doesn't itself define anything specific for that column.
If it does, you need to overwrite that specific column using `custom_table_header_config`.
:::

```yaml
custom_plot_config:
Expand All @@ -550,8 +554,9 @@ custom_plot_config:
min: 1000
```

Now for header-specific changes.
To change the number of decimals used in the General Statistics table for the Qualimap _Mean Coverage_ column:
### Config for a specific column

To change the number of decimals used in the General Statistics table for the single column _Qualimap: Mean Coverage_:

```yaml
custom_table_header_config:
Expand All @@ -560,6 +565,18 @@ custom_table_header_config:
format: "{:,.20f}"
```

The first key is the table ID, the second is the header ID for the column you want to change.

:::tip
The easiest way to find these IDs is by clicking _Configure Columns_ above the table you want to customise.

![Table: configure columns button](../../images/table_configure_columns.png)

The table ID is shown at the top of the modal window. The _ID_ column shows the column (header) ID.

![Table: configure columns button](../../images/table_header_ids.png)
:::

### Hiding columns

Report tables such as the General Statistics table can get quite wide. To help with this,
Expand Down
Binary file added docs/images/table_configure_columns.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/table_header_ids.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion multiqc/plots/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def make_table(dt):
<h4 class="modal-title">{title}: Columns</h4>
</div>
<div class="modal-body">
<p>Uncheck the tick box to hide columns. Click and drag the handle on the left to change order.</p>
<p>Uncheck the tick box to hide columns. Click and drag the handle on the left to change order. Table ID: <code>{tid}</code></p>
<p>
<button class="btn btn-default btn-sm mqc_configModal_bulkVisible" data-target="#{tid}" data-action="showAll">Show All</button>
<button class="btn btn-default btn-sm mqc_configModal_bulkVisible" data-target="#{tid}" data-action="showNone">Show None</button>
Expand Down

0 comments on commit 7129bd1

Please sign in to comment.