Skip to content

Commit

Permalink
update some comments and fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanliwei-genomics-cn committed Nov 1, 2023
1 parent 7e1c896 commit c5693b0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
2 changes: 2 additions & 0 deletions stereo/algorithm/get_niche.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def main(
data_result.tl.result.set_item_callback = None

for res_key in data_result.tl.key_record['pca']:
if data_result.tl.result[res_key].shape[0] == data_result.shape[0]:
continue
data_result.tl.result[res_key] = data_result.tl.result[res_key][
np.isin(data_full.cell_names, cell_list)].copy()
if cluster_res_key in data_result.cells:
Expand Down
19 changes: 14 additions & 5 deletions stereo/algorithm/time_series_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@

class TimeSeriesAnalysis(AlgorithmBase):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def main(
self,
run_method=RunMethodType.tvg_marker.value,
use_col=UseColType.timepoint.value,
branch=None,
p_val_combination=PValCombinationType.fdr.value,
cluster_number=6
cluster_number=6,
**kwargs
):
"""
:param run_method: the model type when the algorithm is run, default = `tvg_marker`.
Expand All @@ -39,6 +37,17 @@ def main(
:param p_val_combination: p_value combination method to use, choosing from ['fisher', 'mean', 'FDR']
:param cluster_number: number of cluster
The parameters below only for `other` run method.
:param spatial_weight: the weight to combine spatial feature
:param n_spatial_feature: n top features to combine of spatial feature
:param temporal_mean_threshold: filter out genes of which mean absolute temporal feature <= temporal_mean_threshold # noqa
:param temporal_top_threshold: filter out genes of which top absolute temporal feature < temporal_top_threshold
:param Epsilon: max value to finish iteration
:param w_size: window size to rasterizing spatial expression, see also data.tl.gene_spatial_feature
:param use_col: the col in obs representing celltype or clustering
:param branch: celltypes order in use_col
"""
if run_method == RunMethodType.tvg_marker.value:
self.TVG_marker(
Expand All @@ -47,7 +56,7 @@ def main(
p_val_combination=p_val_combination
)
else:
self.fuzzy_C_gene_pattern_cluster(cluster_number)
self.fuzzy_C_gene_pattern_cluster(cluster_number, **kwargs)

def TVG_marker(self, use_col, branch, p_val_combination=PValCombinationType.fisher.value):
"""
Expand Down
10 changes: 3 additions & 7 deletions stereo/tools/cell_correct.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,21 +289,17 @@ def cell_correct(out_dir: str,
* GEM and raw CGEF (not have been corrected)
* BGEF and raw CGEF (not have been corrected)
:param out_dir: the path to save intermediate result, like mask (if generate from ssDNA image),
BGEF (generate from GEM), CGEF (generate from GEM and mask), etc. and final corrected result.
:param out_dir: the path to save intermediate result, like mask (if generated from ssDNA image),
BGEF (generated from GEM), CGEF (generated from GEM and mask), etc. and final corrected result.
:param threshold: threshold size, default to 20.
:param gem_path: the path to GEM file.
:param bgef_path: the path to BGEF file.
:param raw_cgef_path: the path to CGEF file which not has been corrected.
:param mask_path: the path to mask file.
:param process_count: the count of the processes or threads will be started when correct cells, defaults to None
by default, it will be set to 10 when `fast` is set to False and will be set to 1 when `fast` is set to v1 or v2.
by default, it will be set to 10 when `method` is set to 'GMM' and will be set to 1 when `method` is set to 'FAST' or 'EDM'.
if it is set to -1, all of the cores will be used.
:param only_save_result: if `True`, only save result to disk; if `False`, return an StereoExpData object.
:param fast: specify the version of algorithm, available values include [False, v1, v2], defaults to v2.
False: the oldest and slowest version, it will uses multiprocessing if set `process_count` to more than 1.
v1: the first fast version, it olny uses single process and single threading.
v2: default and recommended algorithm, the latest fast version, faster and more accurate than v1, it will uses multithreading if set `process_count` to more than 1.
:param method: correct in different method if `method` is set, otherwise `EDM`.
:param distance: outspread distance based on cellular contour of cell segmentation image, in pixels, only available for v2 algorithm.
Expand Down

0 comments on commit c5693b0

Please sign in to comment.