Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise an Exception if the column_data row_names of the alternative_experiments are not the same as those of the main experiment. #49

Open
DiDeoxy opened this issue Oct 31, 2024 · 0 comments

Comments

@DiDeoxy
Copy link

DiDeoxy commented Oct 31, 2024

def _validate_alternative_experiments(alternative_experiments, shape):
if alternative_experiments is None:
raise ValueError(
"'alternative_experiments' cannot be `None`, must be assigned to an empty dictionary."
)
if not isinstance(alternative_experiments, dict):
raise TypeError("'alternative_experiments' is not a dictionary.")
for alt_name, alternative_experiment in alternative_experiments.items():
if not hasattr(alternative_experiment, "shape"):
raise TypeError(
f"Alternative experiment: '{alt_name}' must be a 2-dimensional object."
"Does not contain a `shape` property."
)
if shape[1] != alternative_experiment.shape[1]:
raise ValueError(
f"Alternative experiment: '{alt_name}' does not contain same number of"
" cells."
)

In Bioconductor's SingleCellExperiment class the colData rowNames of the altExps is expected to be that same as the colData rowNames of the main experiment. Currently in Bioconductor if this is not the case the offending colData rowNames are overwritten by those of the main experiment and a Warning is raised that in a future version this will raise an error instead.

Currently in BiocPy's SingleCellExperiment no checks occur whatsoever for identity between main and alternative_experiments column_data row_names.

I propose SingleCellExperiment of BiocPy should raise an Exception if the column_data row_names of the alternative_experiments are not the same those of the main experiment.

@DiDeoxy DiDeoxy changed the title Raise a Exception if the column_data row_names of the alternative_experiments are not the same as those of the main experiment. Raise an Exception if the column_data row_names of the alternative_experiments are not the same as those of the main experiment. Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant