snpio.SNPioMultiQC

class snpio.SNPioMultiQC[source]

A MultiQC module and an in-process builder.

This module is designed to queue plots generated by the SNPio pipeline and render them in a MultiQC report. It provides class methods to queue different types of plots (tables, heatmaps, barplots) and automatically renders them when the module is initialized or when parse_logs() is called.

__init__()[source]

Initialize the SNPioMultiQC module.

This module is designed to queue plots generated by the SNPio pipeline and render them in a MultiQC report. It provides class methods to queue different types of plots (tables, heatmaps, barplots) and automatically renders them when the module is initialized or when parse_logs() is called.

Methods

__init__()

Initialize the SNPioMultiQC module.

add_data_source([f, s_name, path, module, ...])

add_section([name, anchor, id, description, ...])

Add a section to the module report output

add_software_version([version, sample, ...])

Save software versions for module.

build(**kwargs)

Class-level alias to write the MultiQC report to an HTML file.

build_report(**kwargs)

Instance-friendly alias to write the MultiQC report to an HTML file.

clean_child_attributes()

Clean up non-base attribute to save memory.

clean_s_name(s_name, f[, root, filename])

Helper function to take a long file name(s) and strip back to one clean sample name.

find_log_files(sp_key[, filecontents, ...])

Return matches log files of interest. :type sp_key: str :param sp_key: Search pattern key specified in config :type filecontents: bool :param filecontents: f["f"] will contain raw file contents :type filehandles: bool :param filehandles: f["f"] will be the file handle :rtype: Union[Iterable[LoadedFileDict[str]], Iterable[LoadedFileDict[BufferedReader]], Iterable[LoadedFileDict[TextIOWrapper]], Iterable[LoadedFileDict[None]]] :return: Yields a dict with filename (fn), root directory (root), cleaned sample name generated from the filename (s_name) and either the file contents or file handle for the current matched file (f). As yield is used, the results can be iterated over without loading all files at once.

general_stats_addcols(data_by_sample[, ...])

Helper function to add to the General Statistics variable. Adds to report.general_stats and does not return anything. Fills in required config variables if not supplied. :type data_by_sample: Dict[Union[NewType(SampleName, str), str], Dict[Union[NewType(ColumnKey, str), str], Union[int, float, str, bool]]] :param data_by_sample: A dict with the data. Key should be sample name, the data can be a key-value dict. Or, for grouped samples, the key is the group name, and the data is a list of tuples with the first element being the sample name in the group, and the second a key-value dict. :type headers: Union[Mapping[NewType(ColumnKey, str), ColumnDict], Mapping[NewType(ColumnKey, str), Dict[str, Any]], Mapping[str, ColumnDict], Mapping[str, Dict[str, Any]], None] :param headers: Dict with information for the headers, such as colour scales, min and max values etc. See docs/writing_python.md for more information. :type namespace: Optional[str] :param namespace: Append to the module name in the table column description. Can be e.g. a submodule name. :type group_samples_config: SampleGroupingConfig :param group_samples_config: Configuration for grouping samples. :return: None.

get_general_stats_headers(all_headers[, ...])

Get general stats columns for a module based on user configuration.

group_samples_and_average_metrics(...)

Group samples and merges numeric metrics by averaging them, optionally normalizing using normalization_metric_name

group_samples_names(samples)

Group sample name according to a named set of patterns defined in the config.sample_merge_groups dictionary. :type samples: Iterable[NewType(SampleName, str)] :param samples: sample names :rtype: Dict[NewType(SampleGroup, str), List[Tuple[Optional[str], NewType(SampleName, str), NewType(SampleName, str)]]] :return: a dict where the keys are group names, and the values are lists of tuples, of cleaned base names according to the cleaning rules and the original sample names.

groups_for_sample(s_name)

Takes a sample name and returns a trimmed name and groups it's assigned to.

ignore_samples(data[, sample_names_ignore, ...])

Strip out samples which match sample_names_ignore

is_ignore_sample(s_name[, ...])

Should a sample name be ignored?

merge(m)

Running module on a new set of input.

parse_logs()

Render the queued plots in the MultiQC report.

queue_barplot(df, *, panel_id, section, ...)

Queue a bar plot for rendering in the MultiQC report.

queue_boxplot(df, *, panel_id, section, ...)

Queue a box plot for rendering in the MultiQC report.

queue_custom_boxplot(df, *, panel_id, ...[, ...])

Queue a custom box plot for rendering in the MultiQC report.

queue_custom_lineplot(df, *, panel_id, ...)

Queue a custom line plot for rendering in the MultiQC report.

queue_heatmap(df, *, panel_id, section, ...)

Queue a heatmap for rendering in the MultiQC report.

queue_html(html, *, panel_id, section, ...)

Queue an HTML snippet for rendering in the MultiQC report.

queue_linegraph(data, *, panel_id, section, ...)

Queue a line graph for rendering in the MultiQC report.

queue_scatterplot(df, *, panel_id, section, ...)

Queue a scatter plot for rendering in the MultiQC report.

queue_table(df, *, panel_id, section, title, ...)

Queue a table for rendering in the MultiQC report.

queue_violin(df, *, panel_id, section, ...)

Queue a violin plot for rendering in the MultiQC report.

write_data_file(data, fn[, sort_cols, ...])

Saves raw data to a dictionary for downstream use, then redirects to report.write_data_file() to create the file in the report directory

Attributes

mod_cust_config

mod_id

saved_raw_data

Wrapper to give access to private __saved_raw_data.