diff --git a/meteor/mapper.py b/meteor/mapper.py index 53c8b33..951101c 100644 --- a/meteor/mapper.py +++ b/meteor/mapper.py @@ -33,8 +33,8 @@ class Mapper(Session): """Run the bowtie""" DEFAULT_NUM_THREADS : ClassVar[int] = 1 - MAPPING_TYPES: ClassVar[list[str]] = ['end-to-end', 'local'] - DEFAULT_MAPPING_TYPE: ClassVar[str] = 'end-to-end' + MAPPING_TYPES: ClassVar[list[str]] = ["end-to-end", "local"] + DEFAULT_MAPPING_TYPE: ClassVar[str] = "end-to-end" DEFAULT_TRIM: ClassVar[int] = 80 NO_TRIM: ClassVar[int] = 0 DEFAULT_ALIGNMENT_NUMBER: ClassVar[int] = 10000 diff --git a/meteor/profiler.py b/meteor/profiler.py index 61e7125..74daea4 100644 --- a/meteor/profiler.py +++ b/meteor/profiler.py @@ -33,7 +33,7 @@ class Profiler(Session): NO_RAREFACTION: ClassVar[int] = 0 DEFAULT_RAREFACTION_LEVEL: ClassVar[int] = NO_RAREFACTION DEFAULT_RANDOM_SEED: ClassVar[int] = 1234 - NORMALIZATIONS: ClassVar[list[str]] = ["coverage", "fpkm", "raw"] + NORMALIZATIONS: ClassVar[list[str|None]] = [None, "coverage", "fpkm", "raw"] DEFAULT_NORMALIZATION: ClassVar[str] = "coverage" DEFAULT_COVERAGE_FACTOR: ClassVar[float] = 100.0 DEFAULT_CORE_SIZE: ClassVar[int] = 100 @@ -50,6 +50,9 @@ class Profiler(Session): coverage_factor: float def __post_init__(self): + if self.normalization not in Profiler.NORMALIZATIONS: + raise ValueError(f'{self.normalization} is not a valid normalization') + # Get the json file self.sample_config = self.get_census_stage(self.meteor.mapping_dir, 1) diff --git a/meteor/tests/test_profiler.py b/meteor/tests/test_profiler.py index f375cc6..cd6283f 100644 --- a/meteor/tests/test_profiler.py +++ b/meteor/tests/test_profiler.py @@ -31,7 +31,7 @@ def profiler_standard(datadir: Path, tmp_path: Path) -> Profiler: rarefaction_level=-1, seed=12345, coverage_factor=100.0, - normalization="", + normalization=None, core_size=4, msp_filter=0.5, completeness=0.6, diff --git a/meteor/treebuilder.py b/meteor/treebuilder.py index 9eca09d..921374f 100644 --- a/meteor/treebuilder.py +++ b/meteor/treebuilder.py @@ -32,7 +32,7 @@ class TreeBuilder(Session): DEFAULT_MAX_GAP: ClassVar[float] = 0.5 DEFAULT_GAP_CHAR: ClassVar[str] = "-" - OUTPUT_FORMATS: ClassVar[list[str]] = ["png", "svg", "pdf", "txt"] + OUTPUT_FORMATS: ClassVar[list[str|None]] = [None, "png", "svg", "pdf", "txt"] DEFAULT_OUTPUT_FORMAT: ClassVar[str|None] = None DEFAULT_WIDTH: ClassVar[int] = 500 DEFAULT_HEIGHT: ClassVar[int] = 500 @@ -46,6 +46,9 @@ class TreeBuilder(Session): gap_char: str def __post_init__(self) -> None: + if self.format not in TreeBuilder.OUTPUT_FORMATS: + raise ValueError(f'{self.format} is not a valid output format') + self.meteor.tmp_dir = Path(mkdtemp(dir=self.meteor.tmp_path)) self.meteor.tree_dir.mkdir(exist_ok=True, parents=True)