Source code for graph.Loader

from __future__ import annotations

from abc import ABC, abstractmethod

import pandas as pd


[docs] class Loader(ABC): """ Abstract base class for loading and standardizing PPI (protein-protein interaction) data. This class defines the interface for data loaders that retrieve and standardize PPI data from various sources. """ def __init__(self): """Initialize the Loader with empty data.""" self.data = None
[docs] @abstractmethod def retrieve_data(self) -> "Loader": """ Retrieve PPI data from the specified source. Subclasses must implement this method to fetch data from their respective data source and store it internally. Returns: Loader: Self for method chaining. """ pass
[docs] @abstractmethod def standardize_data_format(self) -> "Loader": """ Standardize the format of the retrieved data. Ensures consistency across different data sources by converting raw data into a standardized internal format. Returns: Loader: Self for method chaining. """ pass
[docs] def get_data(self) -> dict: """ Get the standardized data. Returns: dict: Standardized data dictionary containing nodes, edges, and metadata. """ return self.data