spateo.external.CAST.utils

Functions

coords2adjacentmat(coords[, output_mode, strategy_t])

hv_cutoff(max_col[, threshold])

detect_highly_variable_genes(sdata[, batch_key, ...])

extract_coords_exp(sdata[, batch_key, cols, ...])

Harmony_integration(sdata_inte, scaled_layer, ...[, ...])

random_sample(coords_t, nodenum[, seed_t])

sub_node_sum(coords_t, exp_t[, nodenum, vis, seed_t])

nearest_neighbors_idx(coord1, coord2[, mode_t])

non_zero_center_scale(sdata_t_X)

sub_data_extract(sample_list, coords_raw, exps[, ...])

preprocess_fast(sdata1[, mode, target_sum, base, ...])

cell_select(coords_t[, s, c, output_path_t])

Select cells by drawing a polygon on the plot.

get_neighborhood_rad(coords_centroids, ...[, dist])

delta_cell_cal(coords_tgt, coords_ref, ctype_tgt, ...)

coords_tgt: coordinates of niche centroids (target cells).

delta_exp_cal(coords_tgt, coords_ref, exp_tgt, ...[, ...])

coords_tgt: coordinates of niche centroids (target cells).

delta_exp_sigplot(p_values, avg_differences[, ...])

delta_exp_statistics(delta_exp_tgt, delta_exp_ref)

Module Contents

spateo.external.CAST.utils.coords2adjacentmat(coords, output_mode='adjacent', strategy_t='convex')[source]
spateo.external.CAST.utils.hv_cutoff(max_col, threshold=2000)[source]
spateo.external.CAST.utils.detect_highly_variable_genes(sdata, batch_key='batch', n_top_genes=4000, count_layer='count')[source]
spateo.external.CAST.utils.extract_coords_exp(sdata, batch_key='batch', cols='spatial', count_layer='count', data_format='norm1e4', ifcombat=False, if_inte=False)[source]
spateo.external.CAST.utils.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.utils.random_sample(coords_t, nodenum, seed_t=2)[source]
spateo.external.CAST.utils.sub_node_sum(coords_t, exp_t, nodenum=1000, vis=True, seed_t=2)[source]
spateo.external.CAST.utils.nearest_neighbors_idx(coord1, coord2, mode_t='knn')[source]
spateo.external.CAST.utils.non_zero_center_scale(sdata_t_X)[source]
spateo.external.CAST.utils.sub_data_extract(sample_list, coords_raw, exps, nodenum_t=20000, if_non_zero_center_scale=True)[source]
spateo.external.CAST.utils.preprocess_fast(sdata1, mode='customized', target_sum=10000.0, base=2, zero_center=True, regressout=False)[source]
spateo.external.CAST.utils.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.utils.get_neighborhood_rad(coords_centroids, coords_candidate, radius_px, dist=None)[source]
spateo.external.CAST.utils.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.utils.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.utils.delta_exp_sigplot(p_values, avg_differences, abs_10logp_cutoff=None, abs_avg_diff_cutoff=None, sig=True)[source]
spateo.external.CAST.utils.delta_exp_statistics(delta_exp_tgt, delta_exp_ref)[source]