Repository navigation
Expand file tree
/
Copy pathcustom_code.py
More file actions
57 lines (44 loc) · 1.95 KB
/
Copy pathcustom_code.py
File metadata and controls
57 lines (44 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
"""MultiQC example plugin functions
We can add any custom Python functions here and call them
using the setuptools plugin hooks.
"""
from __future__ import print_function
from multiqc import config, report
import importlib_metadata
import logging
# Initialise the main MultiQC logger
log = logging.getLogger("multiqc")
# Add default config options for the things that are used in MultiQC_NGI
def example_plugin_execution_start():
"""Code to execute after the config files and
command line flags have been parsedself.
This setuptools hook is the earliest that will be able
to use custom command line flags.
"""
# Halt execution if we've disabled the plugin
if config.kwargs.get("disable_plugin", True):
return None
# Plugin's version number defined in pyproject.toml:
version = importlib_metadata.version("multiqc_example_plugin")
log.info("Running Example MultiQC Plugin v{}".format(version))
# Add to the main MultiQC config object.
# User config files have already been loaded at this point
# so we check whether the value is already set. This is to avoid
# clobbering values that have been customised by users.
# Add to the search patterns used by modules
if "my_example/key_value_pairs" not in config.sp:
config.update_dict(config.sp, {"my_example/key_value_pairs": {"fn": "my_plugin_output.tsv"}})
if "my_example/plot_data" not in config.sp:
config.update_dict(config.sp, {"my_example/plot_data": {"fn": "my_plugin_plotdata.tsv"}})
# Some additional filename cleaning
config.fn_clean_exts.extend([".my_tool_extension", ".removeMetoo"])
# Ignore some files generated by the custom pipeline
config.fn_ignore_paths.extend(
[
"*/my_awesome_pipeline/fake_news/*",
"*/my_awesome_pipeline/red_herrings/*",
"*/my_awesome_pipeline/noisy_data/*",
"*/my_awesome_pipeline/rubbish/*",
]
)