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

Integrating Configs into helper functions #50

Closed axiomcura closed 1 year ago

axiomcura commented 1 year ago

About this PR

This PR attempts to solve #29 #32 #44 where the initial implementation of the helper functions contained lots of hard coded variables when generating paths.

Motivation

The initial motivation of helper functions was mentioned here #26 where these functions can preemptively generate outputs and input paths before submitting it into a workflow.

The helper functions are heavily coupled to the common.smk module as it attempts to standardize all input and output paths before executing the workflow.

However, the previous design of the helper functions had two problems:

  1. Contained lots of hard coded parameters
  2. Configurations files were not integrated into the helper functions module.

Development

Here is a simple example of the updated helper functions implementation.

The newly implemented helper function, now known as datapaths, contain information from both the general and meta configs. By implementing the config integration, this removes all the hard coded coded values that were initially developed in the previous helper function version.

Inside the datapaths module, there is main function known as build_path, which takes in a data_type parameter. The data_type parameter helps design the output paths with correct extensions, and suffixes listed within the config files.

here's an example:

from cytosnake.helpers import datapaths

aggregated_path = datapaths.build_path(data_type="aggregated")
annotated_path = datapaths.build_path(data_type="annotated")

Other changes

axiomcura commented 1 year ago

@d33bs I have applied your suggestions! Thank you

Also, you have brought up some good discussion points that created some new issues, especially about schemas.

I will be merging now, but we can still have those discussion points in this PR. Thanks again!