Skip to content

Commit

Permalink
mod_docstrings6
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiomarco25 committed Jan 3, 2025
1 parent 62c0697 commit 9adf256
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
8 changes: 3 additions & 5 deletions src/troutpy/pl/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def spatial_interactions(
figsize (Tuple[float, float]): The dimensions of the plot in inches.
dpi (Optional[int]): The resolution (dots per inch) for the plot.
save (Optional[Union[str, Path]]): The path to save the plot image. If `None`, the plot is displayed but not saved.
**kwargs : Any additional arguments passed to the `scatter` or `imshow` functions for customizing plot appearance.
kwargs : Any additional arguments passed to the `scatter` or `imshow` functions for customizing plot appearance.
Returns:
None
Expand Down Expand Up @@ -683,7 +683,7 @@ def interactions_with_arrows(
):
"""
The function plots arrows from source to target cells based on transcript proximity, color-coding source and target cells, and transcript locations. An optional image layer can be overlaid behind the plot.
Parameters:
- sdata (AnnData): The AnnData object containing the spatial omics data.
- layer (str, optional): The key in `sdata` for the extracellular transcript layer to analyze. Default is 'extracellular_transcripts_enriched'.
Expand All @@ -704,13 +704,11 @@ def interactions_with_arrows(
- figsize (Tuple[float, float], optional): Size of the plot. Default is (10, 10).
- dpi (Optional[int], optional): Resolution of the plot. Default is 100.
- save (Optional[Union[str, Path]], optional): If provided, the path where the plot will be saved.
- **kwargs: Additional arguments passed to the `scatter` and `imshow` functions for customization.
- kwargs: Additional arguments passed to the `scatter` and `imshow` functions for customization.
Returns:
- None: The function displays or saves a plot of interactions between cells and transcripts.
Notes:
The plot will show arrows from source to target cells, with different colors for source, target, and transcript points.
"""
# Extract relevant data
transcripts = sdata.points[layer]
Expand Down
26 changes: 13 additions & 13 deletions src/troutpy/tl/segmentation_free.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ def segmentation_free_clustering(
This function clusters transcriptomic data without relying on pre-defined cell or tissue segmentations.It supports multiple clustering methods, with Points2Regions being the default.
Parameters:
- sdata (SpatialData): A spatial data object containing transcriptomic information.
- params (dict): A dictionary of parameters for the selected clustering method.For `points2regions`:
- 'num_clusters' (int): Number of clusters (default: 300).
- 'pixel_width' (float): Pixel width parameter (default: 0.4).
- 'pixel_smoothing' (float): Pixel smoothing parameter (default: 3.5).
- x (str): Column name for the x-coordinates of transcripts.
- y (str): Column name for the y-coordinates of transcripts.
- feature_name (str): Column name for the feature names.
- method (str, optional): Clustering method to use. Options:
- 'points2regions': Uses the Points2Regions algorithm for clustering.
- 'sainsc': Placeholder for another clustering method.
- transcript_id (str, optional): Column name for the transcript IDs.
- copy (bool): If True, returns a copy of the clustering results. If False, updates `sdata` in-place.
sdata (SpatialData): A spatial data object containing transcriptomic information.
params (dict): A dictionary of parameters for the selected clustering method.For `points2regions`:
- 'num_clusters' (int): Number of clusters (default: 300).
- 'pixel_width' (float): Pixel width parameter (default: 0.4).
- 'pixel_smoothing' (float): Pixel smoothing parameter (default: 3.5).
x (str): Column name for the x-coordinates of transcripts.
y (str): Column name for the y-coordinates of transcripts.
feature_name (str): Column name for the feature names.
method (str, optional): Clustering method to use. Options:
- 'points2regions': Uses the Points2Regions algorithm for clustering.
- 'sainsc': Placeholder for another clustering method.
transcript_id (str, optional): Column name for the transcript IDs.
copy (bool): If True, returns a copy of the clustering results. If False, updates `sdata` in-place.
Returns:
Optional[anndata.AnnData]: If `copy` is True, returns an AnnData object containing the clustering results.Otherwise, updates the `sdata` object in-place and returns None.
Expand Down

0 comments on commit 9adf256

Please sign in to comment.