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

Reduce complexity in `CytoSnake` scripts #41

Open axiomcura opened 1 year ago

axiomcura commented 1 year ago

Mentioned in #37 in this comment

The script design is unnecessarily complex, since we are only using a single function call; therefore it should be encapsulated into a single main() function to reduce complexity instead of two.

Example:


import cytotable

def function1(param1, param2, param3):
   # enter code here 
   cytotable.convert(param1, param2, param3)
   return 0

def main ():
   p1 = snakemake.param[0]
   p2 = snakemake.param[1]
   p3 = snakemake.param[2]

   function1(p1, p2, p3)

if __main__ == "__name__"
   main()

can be reduced to:


def main ():
   p1 = snakemake.param[0]
   p2 = snakemake.param[1]
   p3 = snakemake.param[2]

   function1(p1, p2, p3)

if __main__ == "__name__"
   main()

Todo list

axiomcura commented 1 year ago

small update regarded about this issue:

turns out that sectioning parameters is not ideal for instances where there are two functions used from the same parameter. Therefore the best approach is the load in the whole configuration instead of sectioning it.

First we the scripts have to be designed in order for it to be simple enough to allow whole config integration.