From a66bf43829b35b4d63386ff1389744d372c5ae86 Mon Sep 17 00:00:00 2001 From: xingzhongyu Date: Wed, 18 Dec 2024 11:31:10 +0800 Subject: [PATCH 1/5] add note --- dance/transforms/filter.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dance/transforms/filter.py b/dance/transforms/filter.py index 8ec0ac1f..ef703d0d 100644 --- a/dance/transforms/filter.py +++ b/dance/transforms/filter.py @@ -274,6 +274,20 @@ def __init__( @register_preprocessor("filter", "cell") @add_mod_and_transform class FilterCellsCommonMod(BaseTransform): + """Initialize the FilterCellsCommonMod class. + + Parameters + ---------- + mod1 : str + Name of the first modality in the single-cell dataset. + mod2 : str + Name of the second modality in the single-cell dataset. + sol : Optional[str], default=None + Name of the optional solution dataset containing cell labels or annotations. + **kwargs : dict + Additional keyword arguments passed to the base transformation class. + + """ def __init__(self, mod1: str, mod2: str, sol: Optional[str] = None, **kwargs): super().__init__(**kwargs) From 78493331a45724c09ece9fab37eb0705ed67f176 Mon Sep 17 00:00:00 2001 From: xingzhongyu Date: Wed, 18 Dec 2024 11:49:24 +0800 Subject: [PATCH 2/5] minor --- dance/utils/wrappers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dance/utils/wrappers.py b/dance/utils/wrappers.py index 28ffefe8..74336b9c 100644 --- a/dance/utils/wrappers.py +++ b/dance/utils/wrappers.py @@ -107,6 +107,16 @@ def new_init(self, *args, **kwargs): @functools.wraps(original_call) def new_call(self, data: Data, *args, **kwargs): + """ + Parameters + ---------- + data : Data + The input data object containing the `mudata` with multiple modalities. + Returns + ------- + Any + The result of the original_call method. + """ if hasattr(self, 'mod') and self.mod is not None: md_data = data.data ad_data = Data(data=transform_mod_to_anndata(md_data, self.mod)) From 1b8dd4769a7778cf0a7f4e2450e57ee7dcdb4b6a Mon Sep 17 00:00:00 2001 From: xingzhongyu Date: Wed, 18 Dec 2024 11:51:33 +0800 Subject: [PATCH 3/5] minor --- dance/utils/wrappers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dance/utils/wrappers.py b/dance/utils/wrappers.py index 74336b9c..a7f308ee 100644 --- a/dance/utils/wrappers.py +++ b/dance/utils/wrappers.py @@ -95,6 +95,8 @@ def wrapped_func(*args): def add_mod_and_transform(cls): + """A decorator that modifies a class to add functionality for working with specific + modalities (`mod`) in a `mudata` object.""" original_init = cls.__init__ original_call = cls.__call__ cls.add_mod_and_transform = "add_mod_and_transform" From e420a6d049014762be0e8fb87846ab053c7ec523 Mon Sep 17 00:00:00 2001 From: xzy Date: Wed, 18 Dec 2024 17:00:36 +0800 Subject: [PATCH 4/5] translate notes --- examples/get_result_web.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/get_result_web.py b/examples/get_result_web.py index 891c98d9..c4d6a0d8 100644 --- a/examples/get_result_web.py +++ b/examples/get_result_web.py @@ -16,22 +16,24 @@ def check_identical_strings(string_list): if not string_list: - raise ValueError("列表为空") + raise ValueError("The list is empty") arr = np.array(string_list) if not np.all(arr == arr[0]): - raise ValueError("发现不同的字符串") + raise ValueError("Different strings found") return string_list[0] # if not string_list: - # raise ValueError("列表为空") + # raise ValueError("The list is empty") # first_string = string_list[0] # for s in string_list[1:]: # if s != first_string: - # raise ValueError(f"发现不同的字符串: '{first_string}' 和 '{s}'") + # raise ValueError(f"Different strings found: '{first_string}' and '{s}'") # return first_string + + def get_sweep_url(step_csv: pd.DataFrame, single=True): ids = step_csv["id"] sweep_urls = [] @@ -57,7 +59,7 @@ def spilt_web(url: str): if match: entity = match.group(1) project = match.group(2) - pattern = r'/sweeps/([^/?]+)' # 正则表达式模式 + pattern = r'/sweeps/([^/?]+)' # Regular expression pattern match = re.search(pattern, url) if match: sweep_id = match.group(1) @@ -161,8 +163,8 @@ def write_ans(tissue): step3_urls = [] for i in range(3): file_csv = f"{file_path}/results/params/{i}_best_test_acc.csv" - if not os.path.exists(file_csv): #no parameter - print(f"文件 {file_csv} 不存在,跳过。") + if not os.path.exists(file_csv): # no parameter + print(f"File {file_csv} does not exist, skipping.") continue step3_urls.append(get_sweep_url(pd.read_csv(file_csv))) step3_str = ",".join(step3_urls) From 67fb57b97f0a8bde492c22d2fa27043446087938 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:02:17 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/get_result_web.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/get_result_web.py b/examples/get_result_web.py index c4d6a0d8..c69e9d4e 100644 --- a/examples/get_result_web.py +++ b/examples/get_result_web.py @@ -24,7 +24,6 @@ def check_identical_strings(string_list): return string_list[0] - # if not string_list: # raise ValueError("The list is empty") # first_string = string_list[0]