-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Workflow:
cp_process_singlecells
! (#37)
* fixed minor pathing bugs * `cp_process_singlecells` init workflow * created cytotable env * added cytotable config * added convert.py script * added parquet variable in common.smk * added converted parquet helper func * update common.smk * added configs param * init cp_process_singlecells workflow * Fixed typos * updated cytotable_convert.smk rule module * added new error * added new loader function for general configs * added more guards * update convert.py * fixed extension bug * removed cytosnake imports see #18 * update config * fixed parameters naming * fixed bugs with convert and normalize scripts * added default env manager * update pathing and fix #35 * update workflow added documentation * workflow update * update configs for normalize * update feature select module * removed unused import * added documentation * fixed typo * added suggestions * Update cytosnake/utils/cyto_paths.py Co-authored-by: Dave Bunten <[email protected]> * Update workflows/scripts/convert.py Co-authored-by: Dave Bunten <[email protected]> * added comments and suggestions changes * added pre-commit tools * pre-commit formatting * added documentation * added snakemake input documentation * added documentation * removed new lines * updated convert link and params --------- Co-authored-by: Dave Bunten <[email protected]>
- Loading branch information
Showing
29 changed files
with
485 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cytotable_convert: | ||
params: | ||
dest_datatype: parquet | ||
source_datatype: sqlite | ||
concat: True | ||
join: True | ||
infer_common_schema: True | ||
drop_null: True | ||
preset: cellprofiler_sqlite | ||
log_level: ERROR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: cp_process_singlecells_configs | ||
|
||
# Documentation | ||
docs: | | ||
Description: | ||
------------ | ||
Converts sqlite plate data into parquet and returns selected features in csv | ||
format | ||
Workflow Steps: | ||
--------------- | ||
Below the workflow steps are separated in chunks. | ||
cytotable_convert: | ||
Takes in sqlite file and converts it into a parquet file. | ||
Uses CytoTable's convert workflow which can be found in: | ||
https://cytomining.github.io/CytoTable/python-api.html#cytotable.convert.convert | ||
normalize_configs: | ||
Noramlizes single cell morphological features | ||
Uses Pycytominer normalization module: | ||
https://github.com/cytomining/pycytominer/blob/master/pycytominer/normalize.py | ||
feature_select_configs: | ||
Selects morphological features from normalized dataset | ||
Uses Pycytominer feature extraction module | ||
https://github.com/cytomining/pycytominer/blob/master/pycytominer/feature_select.py | ||
cytotable_convert: | ||
params: | ||
dest_datatype: parquet | ||
source_datatype: sqlite | ||
concat: True | ||
join: True | ||
infer_common_schema: True | ||
drop_null: True | ||
preset: cellprofiler_sqlite | ||
log_level: ERROR | ||
|
||
normalize_configs: | ||
params: | ||
features: infer | ||
image_features: False | ||
meta_features: infer | ||
samples: all | ||
method: mad_robustize | ||
compression_options: | ||
method: gzip | ||
mtime: 1 | ||
float_format: null | ||
mad_robustize_epsilon: 1.0e-18 | ||
spherize_center: True | ||
spherize_method: ZCA-cor | ||
spherize_epsilon: 1.0e-6 | ||
|
||
feature_select_configs: | ||
params: | ||
features: infer | ||
image_features: False | ||
samples: all | ||
operation: | ||
- variance_threshold | ||
- drop_na_columns | ||
- correlation_threshold | ||
- drop_outliers | ||
- blocklist | ||
na_cutoff: 0.05 | ||
corr_threshold: 0.9 | ||
corr_method: pearson | ||
freq_cut: 0.05 | ||
unique_cut: 0.1 | ||
compression_options: | ||
method: gzip | ||
mtime: 1 | ||
float_format: null | ||
blocklist_file: null | ||
outlier_cutoff: 15 | ||
noise_removal_perturb_groups: null | ||
noise_removal_stdev_cutoff: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
module: ext_guards.py | ||
Checks if the correct extensions are provided | ||
""" | ||
|
||
import pathlib | ||
from typing import TypeGuard | ||
|
||
from cytosnake.guards.path_guards import is_valid_path | ||
|
||
|
||
def has_parquet_ext(file_name: str | pathlib.Path) -> TypeGuard[str]: | ||
"""Checks if the provided file path contains parquet file extension . | ||
Parameters | ||
---------- | ||
file_name : str | pathlib.Path | ||
path to file | ||
Returns | ||
------- | ||
TypeGuard[str] | ||
return True if it is a parquet file, else False | ||
""" | ||
return ( | ||
file_name.suffix in [".parquet", ".parq", ".pq"] | ||
if is_valid_path(file_name) | ||
else False | ||
) | ||
|
||
|
||
def has_sqlite_ext(file_name: str | pathlib.Path) -> TypeGuard[str]: | ||
"""Checks if the provided file path contains parquet file extension . | ||
Parameters | ||
---------- | ||
file_name : str | pathlib.Path | ||
path to file | ||
Returns | ||
------- | ||
TypeGuard[str] | ||
return True if it is a parquet file, else False | ||
""" | ||
|
||
return ( | ||
file_name.suffix in [".sqlite", ".sqlite3"] | ||
if is_valid_path(file_name) | ||
else False | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.