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
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
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