Tools#

sparty.tl.pseudobulk(adata, replicate, condition, groups_key, conds=None, pairwise=None, groups=None, key_added='results', paired=False, layer='counts', min_cells=5, min_counts=100, min_count_gene=10, min_total_count_gene=15, design=None, digits=3, shrink_LFC=False, join_by='..', quiet=True)#

Decoupler pydeseq2 pseudobulk handler.

Parameters:
  • adata (AnnData) – AnnData object.

  • replicate (str) – replicate key

  • condition (str) – condition key

  • conds (list | None (default: None)) – list of the 2 conditions to compare. First is the test and second is the ref

  • groups_key (str) – sdata.table.obs key, i.e. cell types

  • groups (list | None (default: None)) – specify the cell types to work with

  • key_added (str (default: 'results')) – The key added to adata.uns['sparty'] result is saved to.

  • layer (str (default: 'counts')) – sdata.table count values layer

  • min_cells (int (default: 5)) – minimum cell number to keep replicate

  • min_counts (int (default: 100)) – minimum total count to keep replicate

  • design (str (default: None)) – Model design, default will be ‘~condition’ parameters

  • sign_thr – significant value threshold

  • lFCs_thr – log-foldchange value threshold

  • save – wether or not to save plots and tables

  • save_prefix – prefix for saved plot and tables

  • figsize – figure size

Returns:

Return a global pd.DataFrame containing the pseudobulk analysis for plotting.

sparty.tl.alpha_shape_optimal(sdata, group_by, groups, table_key='table', cell_id='cell_id', convex_hull=False, only_shape=True, percentile=99.0, region='region', connectivity_key='spatial_connectivities', distances_key='spatial_distances', neighs_key='spatial_neighbors', option=1)#
sparty.tl.centerline(polygon, n_clusters=3, distance=5000, length_max=5, random_state=130, img_val=None, threshold=120)#

Compute the centerline

Return type:

LineString

Args:

polygon (shapely.Polygon): _description_ n_clusters (int, optional): _description_. Defaults to 3. distance (int, optional): _description_. Defaults to 5000. length_max (int, optional): _description_. Defaults to 5. random_state (int, optional): _description_. Defaults to 130. img_val (_type_, optional): _description_. Defaults to None. threshold (int, optional): _description_. Defaults to 120.

Returns:

shapely.LineString: _description_

sparty.tl.unassigned_RNA(sdata, bin_size_um=10, transcript_key='transcripts', feature_key='feature_name', shape_key='bin_boundaries', table_key='unassigned', bin_key='bin_id', techno='Xenium', min_counts=0, add_bin_shape=False, only_scale=False, target_coordinates='global')#