-
Notifications
You must be signed in to change notification settings - Fork 36
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
add_transform_test #401
base: main
Are you sure you want to change the base?
add_transform_test #401
Conversation
@xingzhongyu Please let me know when it is ready review. Thanks! |
@RemyLau OK. I need to add some comments to review in the transform test part , and the automatic machine learning part needs to be modified |
@@ -34,6 +36,7 @@ def scale_to_RGB(self, channel, truncated_percent): | |||
|
|||
def __call__(self, data: Data) -> Data: | |||
xy_pixel = data.get_feature(return_type="numpy", channel="spatial_pixel", channel_type="obsm") | |||
sc.pp.neighbors(data.data, n_neighbors=self.n_neighbors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neighbors need to be calculated in advance
@@ -86,5 +86,5 @@ def __call__(self, data): | |||
sim_matrix_all = np.array(sim_matrix_all) | |||
sim_matrix_mean = np.mean(sim_matrix_all, axis=0) | |||
|
|||
data.data.uns[self.out] = sim_matrix_mean | |||
data.data.obsm[self.out] = sim_matrix_mean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to obsm
data = Data(adata.copy()) | ||
RESEPTgraph = RESEPTGraph() | ||
RESEPTgraph(data) | ||
assert data.data.uns['RESEPTGraph'].shape == (2000, 2000, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize to (2000,2000,3)
sc3feature = SC3Feature() | ||
data = sc3feature(data) | ||
sc3_feature = data.get_feature(return_type="numpy", channel="SC3Feature", channel_type="obsm") | ||
assert sc3_feature.shape[0] == data.shape[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test passed
tangramFeature = TangramFeature() | ||
data = tangramFeature(data) | ||
tangram_feature = data.get_feature(return_type="numpy", channel="TangramFeature", channel_type="obs") | ||
assert np.sum(tangram_feature) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the sum is 1 and the test passed
data = Data(adata.copy()) | ||
data = CellTypeNums()(data) | ||
cell_type_nums = data.get_feature(return_type="numpy", channel="CellTypeNums", channel_type="uns") | ||
return cell_type_nums.shape[0] == len(np.unique(cell_types)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test passed.Make sure the number of cell types is the same
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@@ -434,7 +434,7 @@ def _sanitize_params( | |||
params_dict = params | |||
params = [None] * pipeline_length | |||
for i, j in params_dict.items(): | |||
idx, key = i.split(f"{Pipeline.PIPELINE_KEY}.", 1)[1].split(".", 1) | |||
idx, key = i.split(f"{Pipeline.PIPELINE_KEY}.", i)[1].split(".", 1) | |||
idx = int(idx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should be PARAMS_KEY
dance/pipeline.py
Outdated
@@ -728,7 +728,12 @@ def _params_search_space(self) -> Dict[str, Dict[str, Optional[Union[str, float] | |||
for i, param_dict in enumerate(self.candidate_params): | |||
if param_dict is not None: | |||
for key, val in param_dict.items(): | |||
search_space[f"{self.PARAMS_KEY}.{i}.{key}"] = val | |||
if type(val) == DictConfig: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
add CellTypeNums SC3Feature RESEPTGraph TangramFeature test
Changed local github repository. So I will pre-commit install next time
The code of the automl demo is a bit irregular. I will continue to modify it in the future and learn singularity if necessary.
It is ready to review in the transform test part @RemyLau
complete automl in single modality,maybe need to change it.
More information is needed on the inputs, functions, and return values of functions
In general, leave out the outdated comments.They're caused by file moves, which I've pretty much added to the new file.