Skip to content

Eido Built-in Filters API

Overview

Eido provides built-in filter functions that can transform PEP projects into different output formats. These filters are useful for converting PEPs to various representations like YAML, CSV, or other formats.

Available Filters

Eido includes several built-in filters for converting and exporting PEP data:

  • basic_pep_filter: Returns the basic PEP representation
  • yaml_pep_filter: Converts PEP to YAML format
  • csv_pep_filter: Exports sample tables as CSV
  • yaml_samples_pep_filter: Exports only sample data as YAML

API Reference

Filter Functions

basic_pep_filter

basic_pep_filter(p, **kwargs)

Basic PEP filter, that does not convert the Project object.

This filter can save the PEP representation to file, if kwargs include path.

:param peppy.Project p: a Project to run filter on

Source code in eido/conversion_plugins.py
 7
 8
 9
10
11
12
13
14
15
def basic_pep_filter(p, **kwargs) -> Dict[str, str]:
    """
    Basic PEP filter, that does not convert the Project object.

    This filter can save the PEP representation to file, if kwargs include `path`.

    :param peppy.Project p: a Project to run filter on
    """
    return {"project": str(p)}

yaml_pep_filter

yaml_pep_filter(p, **kwargs)

YAML PEP filter, that returns Project object representation.

This filter can save the YAML to file, if kwargs include path.

:param peppy.Project p: a Project to run filter on

Source code in eido/conversion_plugins.py
35
36
37
38
39
40
41
42
43
44
45
def yaml_pep_filter(p, **kwargs) -> Dict[str, str]:
    """
    YAML PEP filter, that returns Project object representation.

    This filter can save the YAML to file, if kwargs include `path`.

    :param peppy.Project p: a Project to run filter on
    """
    from yaml import dump

    return {"project": dump(p.config, default_flow_style=False)}

csv_pep_filter

csv_pep_filter(p, **kwargs)

CSV PEP filter, that returns Sample object representations

This filter can save the CSVs to files, if kwargs include sample_table_path and/or subsample_table_path.

:param peppy.Project p: a Project to run filter on

Source code in eido/conversion_plugins.py
48
49
50
51
52
53
54
55
56
57
def csv_pep_filter(p, **kwargs) -> Dict[str, str]:
    """
    CSV PEP filter, that returns Sample object representations

    This filter can save the CSVs to files, if kwargs include
    `sample_table_path` and/or `subsample_table_path`.

    :param peppy.Project p: a Project to run filter on
    """
    return {"samples": MultilineOutputFormatter.format(p.samples)}

yaml_samples_pep_filter

yaml_samples_pep_filter(p, **kwargs)

YAML samples PEP filter, that returns only Sample object representations.

This filter can save the YAML to file, if kwargs include path.

:param peppy.Project p: a Project to run filter on

Source code in eido/conversion_plugins.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def yaml_samples_pep_filter(p, **kwargs) -> Dict[str, str]:
    """
    YAML samples PEP filter, that returns only Sample object representations.

    This filter can save the YAML to file, if kwargs include `path`.

    :param peppy.Project p: a Project to run filter on
    """
    from yaml import dump

    samples_yaml = []
    for s in p.samples:
        samples_yaml.append(s.to_dict())

    return {"samples": dump(samples_yaml, default_flow_style=False)}