Skip to content

Commit b061cee

Browse files
authored
Merge branch 'develop' into remove-hardcoded-paths/rnaseq
2 parents 99afd90 + 06b14af commit b061cee

13 files changed

Lines changed: 1874 additions & 657 deletions

.pre-commit-config.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# See https://pre-commit.com for more information
2-
# See https://pre-commit.com/hooks.html for more hooks
31
repos:
4-
- repo: https://github.com/opensource-nepal/commitlint
5-
rev: v1.2.0
2+
- repo: https://github.com/commitizen-tools/commitizen
3+
rev: master
64
hooks:
7-
- id: commitlint
8-
name: Commit Lint
5+
- id: commitizen
6+
stages: [ commit-msg ]

main/COMO.ipynb

Lines changed: 124 additions & 197 deletions
Large diffs are not rendered by default.

main/como/merge_xomics.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from como import proteomics_gen, return_placeholder_data
1818
from como.combine_distributions import _combine_zscores
19-
from como.custom_types import RNASeqPreparationMethod
19+
from como.custom_types import RNAPrepMethod
2020
from como.project import Config
2121
from como.utils import split_gene_expression_data
2222

@@ -93,7 +93,7 @@ def __post_init__(self):
9393
raise ValueError("Adjust method must be either 'progressive', 'regressive', 'flat', or 'custom'")
9494

9595

96-
def _load_rnaseq_tests(filename, context_name, prep_method: RNASeqPreparationMethod) -> tuple[str, pd.DataFrame]:
96+
def _load_rnaseq_tests(filename, context_name, prep_method: RNAPrepMethod) -> tuple[str, pd.DataFrame]:
9797
"""Load rnaseq results.
9898
9999
Returns a dictionary of test (context, context, cell, etc ) names and rnaseq expression data
@@ -112,11 +112,11 @@ def load_dummy_dict():
112112
raise FileNotFoundError(f"Error: Config file not found at {inquiry_full_path}")
113113

114114
match prep_method:
115-
case RNASeqPreparationMethod.TOTAL:
115+
case RNAPrepMethod.TOTAL:
116116
filename = f"rnaseq_total_{context_name}.csv"
117-
case RNASeqPreparationMethod.MRNA:
117+
case RNAPrepMethod.MRNA:
118118
filename = f"rnaseq_mrna_{context_name}.csv"
119-
case RNASeqPreparationMethod.SCRNA:
119+
case RNAPrepMethod.SCRNA:
120120
filename = f"rnaseq_scrna_{context_name}.csv"
121121
case _:
122122
raise ValueError(
@@ -344,15 +344,9 @@ async def _merge_xomics(
344344
config = Config()
345345
logger.info(f"Merging data for {context_name}")
346346
# load data for each source if it exists. IF not load an empty dummy dataset
347-
trnaseq = _load_rnaseq_tests(
348-
filename=trnaseq_file, context_name=context_name, prep_method=RNASeqPreparationMethod.TOTAL
349-
)
350-
mrnaseq = _load_rnaseq_tests(
351-
filename=mrnaseq_file, context_name=context_name, prep_method=RNASeqPreparationMethod.MRNA
352-
)
353-
scrnaseq = _load_rnaseq_tests(
354-
filename=scrnaseq_file, context_name=context_name, prep_method=RNASeqPreparationMethod.SCRNA
355-
)
347+
trnaseq = _load_rnaseq_tests(filename=trnaseq_file, context_name=context_name, prep_method=RNAPrepMethod.TOTAL)
348+
mrnaseq = _load_rnaseq_tests(filename=mrnaseq_file, context_name=context_name, prep_method=RNAPrepMethod.MRNA)
349+
scrnaseq = _load_rnaseq_tests(filename=scrnaseq_file, context_name=context_name, prep_method=RNAPrepMethod.SCRNA)
356350
proteomics = proteomics_gen.load_proteomics_tests(filename=proteomics_file, context_name=context_name)
357351

358352
expression_list = []

main/como/rnaseq_gen.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from loguru import logger
1010

1111
from como import Config
12-
from como.custom_types import RNASeqPreparationMethod
12+
from como.custom_types import RNAPrepMethod
1313
from como.rnaseq import FilteringTechnique, save_rnaseq_tests
1414

1515

@@ -22,11 +22,11 @@ class _Arguments:
2222
high_batch_ratio: float
2323
filtering_technique: FilteringTechnique
2424
minimum_cutoff: int | str
25-
library_prep: RNASeqPreparationMethod
25+
library_prep: RNAPrepMethod
2626
taxon: Taxon
2727

2828
def __post_init__(self):
29-
self.library_prep = RNASeqPreparationMethod.from_string(str(self.library_prep))
29+
self.library_prep = RNAPrepMethod.from_string(str(self.library_prep))
3030
self.filtering_technique = FilteringTechnique.from_string(str(self.filtering_technique))
3131

3232
if self.minimum_cutoff is None:
@@ -46,7 +46,7 @@ async def _handle_context_batch(
4646
batch_ratio_high: float,
4747
technique: FilteringTechnique,
4848
cut_off: int | float | str,
49-
prep: RNASeqPreparationMethod,
49+
prep: RNAPrepMethod,
5050
taxon: Taxon,
5151
) -> None:
5252
"""Iterate through each context type and create rnaseq expression file.
@@ -81,9 +81,9 @@ async def _handle_context_batch(
8181
rnaseq_input_filepath = (
8282
config.data_dir / "data_matrices" / context_name / f"gene_counts_matrix_{prep.value}_{context_name}"
8383
)
84-
if prep == RNASeqPreparationMethod.SCRNA:
84+
if prep == RNAPrepMethod.SCRNA:
8585
rnaseq_input_filepath = rnaseq_input_filepath.with_suffix(".h5ad")
86-
elif prep in {RNASeqPreparationMethod.TOTAL, RNASeqPreparationMethod.MRNA}:
86+
elif prep in {RNAPrepMethod.TOTAL, RNAPrepMethod.MRNA}:
8787
rnaseq_input_filepath = rnaseq_input_filepath.with_suffix(".csv")
8888

8989
if not rnaseq_input_filepath.exists():
@@ -117,7 +117,7 @@ async def _handle_context_batch(
117117
async def rnaseq_gen(
118118
# config_filepath: Path,
119119
config_filename: str,
120-
prep: RNASeqPreparationMethod,
120+
prep: RNAPrepMethod,
121121
taxon_id: int | str | Taxon,
122122
replicate_ratio: float = 0.5,
123123
high_replicate_ratio: float = 1.0,

0 commit comments

Comments
 (0)