Skip to content

Commit

Permalink
Check normalization and tree output format
Browse files Browse the repository at this point in the history
  • Loading branch information
fplazaonate committed Apr 2, 2024
1 parent 16c34ae commit 3c57656
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions meteor/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion meteor/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion meteor/tests/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion meteor/treebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 3c57656

Please sign in to comment.