WayScience / CytoSnake

Orchestrating high-dimensional cell morphology data processing pipelines
https://cytosnake.readthedocs.io
Creative Commons Attribution 4.0 International
3 stars 3 forks source link

CLI argument handler restructuring #16

Closed axiomcura closed 2 years ago

axiomcura commented 2 years ago

Motivation

The motivation of this PR is in regards to how cytopipe handles user input arguments from the terminal.

The issue I was facing when working with the previous version of the args module was how fragile it was when introducing different argument patterns.

For example, if I were to develop a new mode that required some user parameters, the args_checker() function required to be completely re-written. This has to not to only accommodate new features being implemented but also the previously designed features.

approach

To approach this problem, I decided to create a class object known as CliControlPanel. The class keeps track of all supported parameters, workflows and argument states.

A unique feature of this class is usage of argument_states. These states are simply boolean data type that tell cytopipe which parameters were selected. This provides easy control flow of different parameters and what operations to execute during run time.

In addition, this allows implementing more features much simpler, since we are only dealing with boolean operators!

The majority of the CliControlPanel implemenation is done within this commit: https://github.com/WayScience/CytoPipe/commit/bcbf011795667563ea8813e9daf40322c4a79b1a

axiomcura commented 2 years ago

Hey! @gwaybio

I have answered one of your comments here. Hopefully my responses provide some clarity of the implementation.

I ended up removing the use_conda_env parameter due to the consequence of providing the user too much flexibility (E.g using their own environments) and may greatly affect reproducibility. commit: f80f6fc5d3e1e4ed71bf1c1f5dc28d76e8717b00

I will be merging this now!