Skip to content

Outputs API

This module manages the file structure and tracking of Snakemake workflow outputs.

seqnado.outputs.SeqnadoOutputFiles

Bases: BaseModel

Collection of output files generated by SeqNado.

all_files property

all_files: List[str]

Return all files in the output collection.

has_consensus_peaks property

has_consensus_peaks

Check if consensus peaks are present in the output files.

select_files

select_files(
    suffix: str,
    include: str | None = None,
    exclude: str | None = None,
    must_include_all_patterns: bool = False,
    use_regex: bool = False,
    case_sensitive: bool = False,
) -> List[str]

Filter files by suffix and optional substring.

Parameters:

Name Type Description Default
suffix str

The file suffix to filter by (e.g. ".txt" or "csv").

required
include str

Substring or regex pattern that must be present in the file path.

None
exclude str

Substring or regex pattern that must NOT be present in the file path.

None
must_include_all_patterns bool

If True, all include patterns must match (AND). If False, any match suffices (OR).

False
use_regex bool

If True, treat include/exclude as regex patterns.

False
case_sensitive bool

If True, matching is case-sensitive.

False

Returns: List[str]: A list of file paths matching the criteria.

Source code in seqnado/outputs/core.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def select_files(
    self, 
    suffix: str, 
    include: str | None = None, 
    exclude: str | None = None,
    must_include_all_patterns: bool = False,
    use_regex: bool = False,
    case_sensitive: bool = False,
) -> List[str]:
    """Filter files by suffix and optional substring.

    Args:
        suffix (str): The file suffix to filter by (e.g. ".txt" or "csv").
        include (str, optional): Substring or regex pattern that must be present in the file path.
        exclude (str, optional): Substring or regex pattern that must NOT be present in the file path.
        must_include_all_patterns (bool): If True, all include patterns must match (AND). If False, any match suffices (OR).
        use_regex (bool): If True, treat include/exclude as regex patterns.
        case_sensitive (bool): If True, matching is case-sensitive.
    Returns:
        List[str]: A list of file paths matching the criteria.
    """
    fs = FileSelector(self.files)
    return fs.select(
        suffix=suffix,
        includes=include,
        excludes=exclude,
        case_sensitive=case_sensitive,
        use_regex=use_regex,
        includes_all=must_include_all_patterns,
    )

select_bigwig_subtype

select_bigwig_subtype(
    method: PileupMethod = PileupMethod.DEEPTOOLS,
    scale: DataScalingTechnique = DataScalingTechnique.UNSCALED,
    assay: Assay | None = None,
)

Select bigWig files of a specific subtype.

Parameters:

Name Type Description Default
method PileupMethod

The pileup method to filter by.

DEEPTOOLS
scale ScaleMethod

The scale method to filter by.

UNSCALED
assay Assay

The assay type to filter by. Defaults to None.

None

Returns:

Type Description

List[str]: A list of bigWig files matching the specified subtype.

Source code in seqnado/outputs/core.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
def select_bigwig_subtype(
    self,
    method: PileupMethod = PileupMethod.DEEPTOOLS,
    scale: DataScalingTechnique = DataScalingTechnique.UNSCALED,
    assay: Assay | None = None,
):
    """Select bigWig files of a specific subtype.

    Args:
        method (PileupMethod): The pileup method to filter by.
        scale (ScaleMethod): The scale method to filter by.
        assay (Assay, optional): The assay type to filter by. Defaults to None.

    Returns:
        List[str]: A list of bigWig files matching the specified subtype.
    """

    if assay is not None:
        return self.select_files(
            ".bigWig",
            include=[method.value, scale.value, assay.value.lower()],
            exclude="/geo_submission/",
            must_include_all_patterns=True,
            case_sensitive=False,
        )
    else:
        return self.select_files(
            ".bigWig",
            include=[method.value, scale.value],
            exclude="/geo_submission/",
            must_include_all_patterns=True,
            case_sensitive=False,
        )

← Back to API Overview