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

add_transform_test #401

Open
wants to merge 186 commits into
base: main
Choose a base branch
from
Open

add_transform_test #401

wants to merge 186 commits into from

Conversation

xingzhongyu
Copy link
Collaborator

@xingzhongyu xingzhongyu commented Jan 13, 2024

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.

@RemyLau
Copy link
Collaborator

RemyLau commented Jan 13, 2024

@xingzhongyu Please let me know when it is ready review. Thanks!

@xingzhongyu
Copy link
Collaborator Author

@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)
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test passed

Copy link
Collaborator Author

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]
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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))
Copy link
Collaborator Author

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

@@ -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)
Copy link
Collaborator Author

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

@@ -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:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change

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

Successfully merging this pull request may close these issues.

2 participants