Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kdoroschak committed Mar 17, 2021
2 parents 4467ec4 + 7a2a9bb commit 38fac06
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 37 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where = src

[options.entry_points]
console_scripts =
poretitioner = poretitioner:main
poretitioner = poretitioner:__main__

[options.extras_require]
pdf = ReportLab>=1.2; RXP
Expand Down
2 changes: 1 addition & 1 deletion src/poretitioner/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from poretitioner import main
from .poretitioner import main

main()
40 changes: 5 additions & 35 deletions src/poretitioner/poretitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import numpy as np

import logger
from . import logger
from .getargs import ARG, COMMAND, get_args
from .utils import segment
from .utils.configuration import CONFIG, readconfig, SegmentConfiguration, GeneralConfiguration
from .utils.configuration import CONFIG, readconfig, SegmentConfiguration, GeneralConfiguration, FilterConfiguration
from .utils.filtering import (
get_plugins,
LengthFilter,
Expand All @@ -20,33 +20,6 @@
StandardDeviationFilter,
)

class Poretitoner:
general_config: GeneralConfiguration
segment_config: SegmentConfiguration

def __init__(self, config):
pass

def segment(self):
pass

def filter(self):
pass

def classify(self):
pass

def quantify(self):
pass


from poretitioner import Poretitoner

porty = Poretitoner("../path/tpo/config.toml")

porty.segment()


def run(args):
# Configures the root application logger.
# After these line, it's safe to log using src.poretitioner.logger.getLogger() throughout the application.
Expand All @@ -71,13 +44,13 @@ def run(args):
bulk_f5_filepath = Path(command_line_args[ARG.BULK_FAST5]).resolve()

seg_config = configuration[CONFIG.SEGMENTATION]
filter_config = configuration[CONFIG.FILTER]
filter_config: FilterConfiguration = configuration[CONFIG.FILTER]
config = configuration[CONFIG.GENERAL]

filters = get_plugins(filter_configs)
filters = get_plugins(filter_config)

save_location = Path(getattr(args, ARG.CAPTURE_DIRECTORY)).resolve()

segmentation_config_str = pprint.pformat(seg_config.__dict__)
general_config_str = pprint.pformat(config.__dict__)
log.warning(f"bulk_f5_filepath: {bulk_f5_filepath}")
Expand Down Expand Up @@ -135,6 +108,3 @@ def main():
args = get_args()
# test_fast5()
run(args)

if __name__ == "__main__":
main()
6 changes: 6 additions & 0 deletions src/poretitioner/utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ def from_json(cls, json_dict: Dict):
}
return cls.__new__(filters)

def __setitem__(self, name, my_filter):
self.filters[name] = my_filter

def __getitem__(self, name):
return self.filters[name]


@dataclass(frozen=True)
class GeneralConfiguration(BaseConfiguration):
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ def prep_capture_windows_test():
assert count_by_channel[channel_number] == 4


@pytest.mark.xfail(reason="Need to implement config (filters currently in progress).")
class TestParallelFindCaptures:
def parallel_find_captures_test(self):
bulk_f5_fname = "src/tests/data/bulk_fast5_dummy.fast5"
Expand Down

0 comments on commit 38fac06

Please sign in to comment.