spateo.external.CAST¶
Submodules¶
Classes¶
Functions¶
|
coords_raw_list: list of numpy arrays, each array is the coordinates of a layer |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Select cells by drawing a polygon on the plot. |
|
|
|
coords_tgt: coordinates of niche centroids (target cells). |
|
coords_tgt: coordinates of niche centroids (target cells). |
|
|
|
|
|
|
|
|
|
|
|
Package Contents¶
- spateo.external.CAST.CAST_STACK_rough(coords_raw_list, ifsquare=True, if_max_xy=True, percentile=None)[source]¶
coords_raw_list: list of numpy arrays, each array is the coordinates of a layer ifsquare: if True, the coordinates will be scaled to a square if_max_xy: if True, the coordinates will be scaled to the max value of the max_range_x and max_range_y, respectively (if ifsquare is False), or the max value of [max_range_x,max_range_y] (if ifsquare is True) percentile: if not None, the min and max will be calculated based on the percentile of the coordinates for each slice.
- spateo.external.CAST.CAST_MARK(coords_raw_t, exp_dict_t, output_path_t, task_name_t=None, gpu_t=None, args=None, epoch_t=None, if_plot=True, graph_strategy='convex', device='cuda:0')[source]¶
- spateo.external.CAST.CAST_PROJECT(sdata_inte, source_sample, target_sample, coords_source, coords_target, scaled_layer='log2_norm1e4_scaled', raw_layer='raw', batch_key='protocol', use_highly_variable_t=True, ifplot=True, n_components=50, umap_n_neighbors=50, umap_n_pcs=30, min_dist=0.01, spread_t=5, k2=1, source_sample_ctype_col='level_2', output_path='', umap_feature='X_umap', pc_feature='X_pca_harmony', integration_strategy='Harmony', ave_dist_fold=3, save_result=True, ifcombat=True, alignment_shift_adjustment=50, color_dict=None, adjust_shift=False, metric_t='cosine', working_memory_t=1000)[source]¶
- spateo.external.CAST.CAST_STACK(coords_raw, embed_dict, output_path, graph_list, params_dist=None, tmp1_f1_idx=None, mid_visual=False, sub_node_idxs=None, rescale=False, corr_q_r=None, if_embed_sub=False, early_stop_thres=None, renew_mesh_trans=True)[source]¶
- spateo.external.CAST.link_plot(all_cosine_knn_inds_t, coords_q, coords_r, k, figsize_t=[15, 20], scale_bar_t=None)[source]¶
- spateo.external.CAST.coords2adjacentmat(coords, output_mode='adjacent', strategy_t='convex')[source]¶
- spateo.external.CAST.detect_highly_variable_genes(sdata, batch_key='batch', n_top_genes=4000, count_layer='count')[source]¶
- spateo.external.CAST.extract_coords_exp(sdata, batch_key='batch', cols='spatial', count_layer='count', data_format='norm1e4', ifcombat=False, if_inte=False)[source]¶
- spateo.external.CAST.Harmony_integration(sdata_inte, scaled_layer, use_highly_variable_t, batch_key, umap_n_neighbors, umap_n_pcs, min_dist, spread_t, source_sample_ctype_col, output_path, n_components=50, ifplot=True, ifcombat=False)[source]¶
- spateo.external.CAST.sub_data_extract(sample_list, coords_raw, exps, nodenum_t=20000, if_non_zero_center_scale=True)[source]¶
- spateo.external.CAST.preprocess_fast(sdata1, mode='customized', target_sum=10000.0, base=2, zero_center=True, regressout=False)[source]¶
- spateo.external.CAST.cell_select(coords_t, s=0.5, c=None, output_path_t=None)[source]¶
Select cells by drawing a polygon on the plot. Click the “Finish Polygon” button to finish drawing the polygon. Click the “Clear Polygon” button to clear the polygon.
- spateo.external.CAST.get_neighborhood_rad(coords_centroids, coords_candidate, radius_px, dist=None)[source]¶
- spateo.external.CAST.delta_cell_cal(coords_tgt, coords_ref, ctype_tgt, ctype_ref, radius_px)[source]¶
coords_tgt: coordinates of niche centroids (target cells). coords_ref: coordinates of reference cells. ctype_tgt: cell type of niche centroids. ctype_ref: cell type of reference cells. radius_px: radius of neighborhood.
Output: return: delta_cell_tgt, delta_cell_ref, delta_cell.
e.g. coords_tgt = coords_final[‘injured’] coords_ref = coords_final[‘normal’] ctype_tgt = sdata.obs[‘Annotation’][right_idx] ctype_ref = sdata.obs[‘Annotation’][left_idx] radius_px = 1000 df_delta_cell_tgt,df_delta_cell_ref,df_delta_cell = delta_cell(coords_tgt,coords_ref,ctype_tgt,ctype_ref,radius_px)
- spateo.external.CAST.delta_exp_cal(coords_tgt, coords_ref, exp_tgt, exp_ref, radius_px, valid_tgt_idx=None, valid_ref_idx=None)[source]¶
coords_tgt: coordinates of niche centroids (target cells). coords_ref: coordinates of reference cells. exp_tgt: gene expression of target cells. exp_ref: gene expression of reference cells. radius_px: radius of neighborhood.
Output: return: delta_exp_tgt, delta_exp_ref, delta_exp.
e.g.
- spateo.external.CAST.delta_exp_sigplot(p_values, avg_differences, abs_10logp_cutoff=None, abs_avg_diff_cutoff=None, sig=True)[source]¶
- spateo.external.CAST.dsplot(coords0, coords_plaque_t, s_cell=10, s_plaque=40, col_cell='#999999', col_plaque='red', cmap_t='vlag', alpha=1, vmax_t=None, title=None, scale_bar_200=None, output_path_t=None, coords0_mask=None)[source]¶
- spateo.external.CAST.kmeans_plot_multiple(embed_dict_t, graph_list, coords, taskname_t, output_path_t, k=20, dot_size=10, scale_bar_t=None, minibatch=True, plot_strategy='sep', axis_off=False)[source]¶