Skip to content

Abstract Base Classes

nplinker.genomics.abc

BGCLoaderBase

BGCLoaderBase(data_dir: str | PathLike)

Bases: ABC

Abstract base class for BGC loader.

Parameters:

  • data_dir (str | PathLike) –

    Path to directory that contains BGC metadata files (.json) or full data genbank files (.gbk).

Source code in src/nplinker/genomics/abc.py
def __init__(self, data_dir: str | PathLike) -> None:
    """Initialize the BGC loader.

    Args:
        data_dir: Path to directory that contains BGC metadata files
            (.json) or full data genbank files (.gbk).
    """
    self.data_dir = str(data_dir)

data_dir instance-attribute

data_dir = str(data_dir)

get_files abstractmethod

get_files() -> dict[str, str]

Get path to BGC files.

Returns:

  • dict[str, str]

    The key is BGC name and value is path to BGC file

Source code in src/nplinker/genomics/abc.py
@abstractmethod
def get_files(self) -> dict[str, str]:
    """Get path to BGC files.

    Returns:
        The key is BGC name and value is path to BGC file
    """

get_bgcs abstractmethod

get_bgcs() -> list[BGC]

Get BGC objects.

Returns:

  • list[BGC]

    A list of BGC objects

Source code in src/nplinker/genomics/abc.py
@abstractmethod
def get_bgcs(self) -> list[BGC]:
    """Get BGC objects.

    Returns:
        A list of BGC objects
    """

GCFLoaderBase

Bases: ABC

Abstract base class for GCF loader.

get_gcfs abstractmethod

get_gcfs(
    keep_mibig_only: bool, keep_singleton: bool
) -> list[GCF]

Get GCF objects.

Parameters:

  • keep_mibig_only (bool) –

    True to keep GCFs that contain only MIBiG BGCs.

  • keep_singleton (bool) –

    True to keep singleton GCFs. A singleton GCF is a GCF that contains only one BGC.

Returns:

  • list[GCF]

    A list of GCF objects

Source code in src/nplinker/genomics/abc.py
@abstractmethod
def get_gcfs(self, keep_mibig_only: bool, keep_singleton: bool) -> list[GCF]:
    """Get GCF objects.

    Args:
        keep_mibig_only: True to keep GCFs that contain only MIBiG
            BGCs.
        keep_singleton: True to keep singleton GCFs. A singleton GCF
            is a GCF that contains only one BGC.

    Returns:
        A list of GCF objects
    """