Skip to content

Commit fc0e55c

Browse files
committed
Docs: fix Sphinx critical errors
- Fix highlight_cells_on_umap docstring indentation - Fix index.rst title level inconsistency - Fix manuscript_data.ipynb heading format
1 parent 47c9662 commit fc0e55c

3 files changed

Lines changed: 49 additions & 53 deletions

File tree

docs/source/index.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,4 @@
4141
Github Repo <https://github.com/dpeerlab/Palantir>
4242

4343

44-
Index
45-
=====
46-
47-
* :ref:`genindex`
44+
**Index:** :ref:`genindex`

notebooks/manuscript_data.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
{
8080
"data": {
8181
"text/plain": [
82-
"AnnData object with n_obs × n_vars = 5780 × 14651\n",
82+
"AnnData object with n_obs \u00d7 n_vars = 5780 \u00d7 14651\n",
8383
" obs: 'clusters', 'palantir_pseudotime', 'palantir_diff_potential'\n",
8484
" uns: 'cluster_colors', 'ct_colors', 'palantir_branch_probs_cell_types'\n",
8585
" obsm: 'tsne', 'MAGIC_imputed_data', 'palantir_branch_probs'"
@@ -111,7 +111,7 @@
111111
{
112112
"data": {
113113
"text/plain": [
114-
"AnnData object with n_obs × n_vars = 6501 × 14913\n",
114+
"AnnData object with n_obs \u00d7 n_vars = 6501 \u00d7 14913\n",
115115
" obs: 'clusters', 'palantir_pseudotime', 'palantir_diff_potential'\n",
116116
" uns: 'cluster_colors', 'ct_colors', 'palantir_branch_probs_cell_types'\n",
117117
" obsm: 'tsne', 'MAGIC_imputed_data', 'palantir_branch_probs'"
@@ -143,7 +143,7 @@
143143
{
144144
"data": {
145145
"text/plain": [
146-
"AnnData object with n_obs × n_vars = 12046 × 14044\n",
146+
"AnnData object with n_obs \u00d7 n_vars = 12046 \u00d7 14044\n",
147147
" obs: 'clusters', 'palantir_pseudotime', 'palantir_diff_potential'\n",
148148
" uns: 'cluster_colors', 'ct_colors', 'palantir_branch_probs_cell_types'\n",
149149
" obsm: 'tsne', 'MAGIC_imputed_data', 'palantir_branch_probs'"
@@ -186,7 +186,7 @@
186186
" - Use the `CreateSeuratObject` function to convert the data into Seurat objects, incorporating counts and metadata from the `anndata` object.\n",
187187
" - Transfer additional data like tSNE embeddings, imputed gene expressions, and cell fate probabilities into the appropriate slots in the Seurat object.\n",
188188
"\n",
189-
"### R Code Snippet:"
189+
"**R Code Snippet:**"
190190
]
191191
},
192192
{
@@ -243,10 +243,10 @@
243243
"R[write to console]: Loading required package: sp\n",
244244
"\n",
245245
"R[write to console]: \n",
246-
"Attaching package: ‘SeuratObject’\n",
246+
"Attaching package: \u2018SeuratObject\u2019\n",
247247
"\n",
248248
"\n",
249-
"R[write to console]: The following object is masked from ‘package:base:\n",
249+
"R[write to console]: The following object is masked from \u2018package:base\u2019:\n",
250250
"\n",
251251
" intersect\n",
252252
"\n",
@@ -271,10 +271,10 @@
271271
"output_type": "stream",
272272
"text": [
273273
"R[write to console]: \n",
274-
"Attaching package: ‘anndata’\n",
274+
"Attaching package: \u2018anndata\u2019\n",
275275
"\n",
276276
"\n",
277-
"R[write to console]: The following object is masked from ‘package:SeuratObject:\n",
277+
"R[write to console]: The following object is masked from \u2018package:SeuratObject\u2019:\n",
278278
"\n",
279279
" Layers\n",
280280
"\n",
@@ -495,4 +495,4 @@
495495
},
496496
"nbformat": 4,
497497
"nbformat_minor": 5
498-
}
498+
}

src/palantir/plot.py

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -348,47 +348,46 @@ def highlight_cells_on_umap(
348348
embedding_basis: str = "X_umap",
349349
figsize: Tuple[float, float] = (6, 6),
350350
) -> Tuple[plt.Figure, plt.Axes]:
351-
"""
352-
Highlights and annotates specific cells on a UMAP plot.
353-
354-
Parameters
355-
----------
356-
data : Union[AnnData, pd.DataFrame]
357-
Either a Scanpy AnnData object or a DataFrame of UMAP coordinates.
358-
cells : Union[List[str], Dict[str, str], pd.Series, pd.Index, np.ndarray, str]
359-
Cells to highlight on the UMAP. Can be provided as:
360-
- a list, dict, or pd.Series: used as cell names (values in dict/Series used as annotations).
361-
- a pd.Index: cell identifiers matching those in the data's index will be highlighted.
362-
- a boolean array-like: used as a mask to select cells from the data's index.
363-
- a string: used to retrieve a boolean mask from the AnnData's .obs attribute.
351+
"""Highlight and annotate specific cells on a UMAP plot.
352+
353+
Parameters
354+
----------
355+
data : Union[AnnData, pd.DataFrame]
356+
Either a Scanpy AnnData object or a DataFrame of UMAP coordinates.
357+
cells : Union[List[str], Dict[str, str], pd.Series, pd.Index, np.ndarray, str]
358+
Cells to highlight on the UMAP. Can be provided as:
359+
- a list, dict, or pd.Series: used as cell names (values in dict/Series used as annotations).
360+
- a pd.Index: cell identifiers matching those in the data's index will be highlighted.
361+
- a boolean array-like: used as a mask to select cells from the data's index.
362+
- a string: used to retrieve a boolean mask from the AnnData's .obs attribute.
364363
annotation_offset : float, optional
365-
Offset for the annotations in proportion to the data range. Default is 0.03.
366-
s : float, optional
367-
Size of the points in the scatter plot. Default is 1.
368-
s_highlighted : float, optional
369-
Size of the points in the highlighted cells. Default is 10.
370-
fig : Optional[plt.Figure], optional
371-
Matplotlib Figure object. If None, a new figure is created. Default is None.
372-
ax : Optional[plt.Axes], optional
373-
Matplotlib Axes object. If None, a new Axes object is created. Default is None.
374-
embedding_basis : str, optional
375-
The key to retrieve UMAP results from the AnnData object. Default is 'X_umap'.
376-
figsize : Tuple[float, float], optional
377-
Size of the figure (width, height) in inches. Default is (6, 6).
378-
379-
Returns
380-
-------
381-
fig : plt.Figure
382-
A matplotlib Figure object containing the UMAP plot.
383-
ax : plt.Axes
384-
The corresponding Axes object.
385-
386-
Raises
387-
------
388-
KeyError
389-
If 'embedding_basis' is not found in 'data.obsm'.
390-
TypeError
391-
If 'cells' is neither list, dict nor pd.Series.
364+
Offset for the annotations in proportion to the data range. Default is 0.03.
365+
s : float, optional
366+
Size of the points in the scatter plot. Default is 1.
367+
s_highlighted : float, optional
368+
Size of the points in the highlighted cells. Default is 10.
369+
fig : Optional[plt.Figure], optional
370+
Matplotlib Figure object. If None, a new figure is created. Default is None.
371+
ax : Optional[plt.Axes], optional
372+
Matplotlib Axes object. If None, a new Axes object is created. Default is None.
373+
embedding_basis : str, optional
374+
The key to retrieve UMAP results from the AnnData object. Default is 'X_umap'.
375+
figsize : Tuple[float, float], optional
376+
Size of the figure (width, height) in inches. Default is (6, 6).
377+
378+
Returns
379+
-------
380+
fig : plt.Figure
381+
A matplotlib Figure object containing the UMAP plot.
382+
ax : plt.Axes
383+
The corresponding Axes object.
384+
385+
Raises
386+
------
387+
KeyError
388+
If 'embedding_basis' is not found in 'data.obsm'.
389+
TypeError
390+
If 'cells' is neither list, dict nor pd.Series.
392391
"""
393392
if isinstance(data, AnnData):
394393
if embedding_basis not in data.obsm:

0 commit comments

Comments
 (0)