Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/como/combine_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _combine_z_distribution_for_context(
return combined_z_matrix_df


async def _begin_combining_distributions(
def _begin_combining_distributions(
context_name: str,
input_matrices: InputMatrices,
batch_names: BatchNames,
Expand Down
50 changes: 21 additions & 29 deletions main/como/merge_xomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ async def _process(

if merge_zfpkm_distribution:
logger.trace("Merging Z-Scores")
await _begin_combining_distributions(
_begin_combining_distributions(
context_name=context_name,
input_matrices=input_matrices,
batch_names=batch_names,
Expand Down Expand Up @@ -650,50 +650,42 @@ async def merge_xomics( # noqa: C901
trna_matrix: pd.DataFrame | None
trna_boolean_matrix: pd.DataFrame | None
trna_metadata: pd.DataFrame | None
trna_matrix, trna_boolean_matrix, trna_metadata = await asyncio.gather(
*[
read_file(trna_matrix_or_filepath),
read_file(trna_boolean_matrix_or_filepath),
read_file(trna_metadata_filepath_or_df),
]
)
trna_matrix, trna_boolean_matrix, trna_metadata = await asyncio.gather(*[
read_file(trna_matrix_or_filepath),
read_file(trna_boolean_matrix_or_filepath),
read_file(trna_metadata_filepath_or_df),
])

# Build mrna items
mrna_matrix: pd.DataFrame | None
mrna_boolean_matrix: pd.DataFrame | None
mrna_metadata: pd.DataFrame | None
mrna_matrix, mrna_boolean_matrix, mrna_metadata = await asyncio.gather(
*[
read_file(mrna_matrix_or_filepath),
read_file(mrna_boolean_matrix_or_filepath),
read_file(mrna_metadata_filepath_or_df),
]
)
mrna_matrix, mrna_boolean_matrix, mrna_metadata = await asyncio.gather(*[
read_file(mrna_matrix_or_filepath),
read_file(mrna_boolean_matrix_or_filepath),
read_file(mrna_metadata_filepath_or_df),
])

# build scrna items

scrna_matrix: pd.DataFrame | None
scrna_boolean_matrix: pd.DataFrame | None
scrna_metadata: pd.DataFrame | None
scrna_matrix, scrna_boolean_matrix, scrna_metadata = await asyncio.gather(
*[
read_file(scrna_matrix_or_filepath),
read_file(scrna_boolean_matrix_or_filepath),
read_file(scrna_metadata_filepath_or_df),
]
)
scrna_matrix, scrna_boolean_matrix, scrna_metadata = await asyncio.gather(*[
read_file(scrna_matrix_or_filepath),
read_file(scrna_boolean_matrix_or_filepath),
read_file(scrna_metadata_filepath_or_df),
])

# build proteomic items
proteomic_matrix: pd.DataFrame | None
proteomic_boolean_matrix: pd.DataFrame | None
proteomic_metadata: pd.DataFrame | None
proteomic_matrix, proteomic_boolean_matrix, proteomic_metadata = await asyncio.gather(
*[
read_file(proteomic_matrix_or_filepath),
read_file(proteomic_boolean_matrix_or_filepath),
read_file(proteomic_metadata_filepath_or_df),
]
)
proteomic_matrix, proteomic_boolean_matrix, proteomic_metadata = await asyncio.gather(*[
read_file(proteomic_matrix_or_filepath),
read_file(proteomic_boolean_matrix_or_filepath),
read_file(proteomic_metadata_filepath_or_df),
])

source_weights = SourceWeights(trna=trna_weight, mrna=mrna_weight, scrna=scrna_weight, proteomics=proteomic_weight)
input_matrices = InputMatrices(trna=trna_matrix, mrna=mrna_matrix, scrna=scrna_matrix, proteomics=proteomic_matrix)
Expand Down
3 changes: 3 additions & 0 deletions main/como/rnaseq_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ async def _build_count_metrics(

Returns:
A dataclass `ReadMatrixResults`

Raises:
ValueError: If no columns to merge on are found, or if no sample columns are found after merging with gene information.
"""
matrix.dropna(subset="ensembl_gene_id", inplace=True)
conversion = await ensembl_to_gene_id_and_symbol(ids=matrix["ensembl_gene_id"].tolist(), taxon=taxon)
Expand Down