sceptic-biomem/ScEpTIC/analysis/base_analysis.py
2026-07-10 10:38:57 +02:00

42 lines
1.2 KiB
Python

from ScEpTIC.analysis.options import AnalysisResultFormat
class ScEpTICAnalysis:
"""
ScEpTIC analysis skeleton
"""
def __init__(self, vm):
self.vm = vm
def run(self):
"""
Executes the analysis
"""
raise NotImplementedError(f"{self.__class__.__name__} must implement run()")
def save_result(self, save_dir, result_format):
"""
Saves the analysis results
:param save_dir: the path where to save the result
:param result_format: the result format
"""
if not isinstance(result_format, AnalysisResultFormat):
raise Exception(f"Wrong result_format for {self.__class__.__name__}: {result_format} is not of type AnalysisResultFormat")
results = self.get_result(result_format)
for name, result in results.items():
with open(f"{save_dir}_{name}.{result_format}", "w") as fp:
fp.write(result)
def get_result(self, result_format):
"""
Returns the analysis result
:param result_format: the result format
"""
raise NotImplementedError(f"{self.__class__.__name__} must implement get_result()")