Skip to content

Commit

Permalink
small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajitjohnson committed Mar 18, 2024
1 parent 2ce9bf7 commit 90ed47f
Show file tree
Hide file tree
Showing 7 changed files with 898 additions and 26 deletions.
750 changes: 750 additions & 0 deletions docs/tutorials/nbs/Prior knowledge based phenotyping.ipynb

Large diffs are not rendered by default.

133 changes: 115 additions & 18 deletions docs/tutorials/nbs/Unsupervised clustering to phenotype cells.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]

name = "SCIMAP"
version = "1.3.9"
version = "1.3.10"
description = "Spatial Single-Cell Analysis Toolkit"

license = "MIT"
Expand Down
7 changes: 7 additions & 0 deletions scimap/plotting/groupCorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
from scipy.stats import zscore
import argparse


plt.rcParams['figure.dpi'] = 100
plt.rcParams['savefig.dpi']=300
plt.rcParams['font.family']='sans serif'
plt.rcParams['font.sans-serif']='Arial'
plt.rcParams['pdf.fonttype']=42

# function
def groupCorrelation(adata,
groupBy,
Expand Down
8 changes: 7 additions & 1 deletion scimap/plotting/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
import argparse


plt.rcParams['figure.dpi'] = 100
plt.rcParams['savefig.dpi']=300
plt.rcParams['font.family']='sans serif'
plt.rcParams['font.sans-serif']='Arial'
plt.rcParams['pdf.fonttype']=42


# function
def heatmap (adata,
groupBy,
Expand Down Expand Up @@ -299,7 +306,6 @@ def plot_category_heatmap_vectorized(data,
cbar_ax.xaxis.set_label_position('top')
cbar.set_label('Mean expression in group')

ax.set_title('Heatmap of Marker Values by Category')
ax.set_xlabel('Markers')
ax.set_ylabel('Categories')

Expand Down
7 changes: 7 additions & 0 deletions scimap/plotting/markerCorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
import warnings
import argparse


plt.rcParams['figure.dpi'] = 100
plt.rcParams['savefig.dpi']=300
plt.rcParams['font.family']='sans serif'
plt.rcParams['font.sans-serif']='Arial'
plt.rcParams['pdf.fonttype']=42

def markerCorrelation (adata,
layer='log',
subsetMarkers=None,
Expand Down
17 changes: 11 additions & 6 deletions scimap/plotting/umap.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
import seaborn as sns
import matplotlib.patches as mpatches

import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
plt.rcParams['figure.dpi'] = 100
plt.rcParams['savefig.dpi']=300
plt.rcParams['font.family']='sans serif'
plt.rcParams['font.sans-serif']='Arial'
plt.rcParams['pdf.fonttype']=42

# function
def umap (adata,
color=None,
use_layer=None,
layer=None,
use_raw=False,
log=False,
label='umap',
Expand All @@ -57,7 +60,7 @@ def umap (adata,
List of keys from `adata.obs.columns` or `adata.var.index` to color the plot.
Allows multiple keys for facetted plotting.
use_layer (str, optional):
layer (str, optional):
Specifies the AnnData layer to use for UMAP calculations. Defaults to using `adata.X`.
use_raw (bool, optional):
Expand Down Expand Up @@ -138,14 +141,16 @@ def umap (adata,
# organise the data
if any(item in color for item in list(adata.obs.columns)):
adataobs = adata.obs.loc[:, adata.obs.columns.isin(color)]
adataobs = adataobs.apply(lambda x: x.astype('category'))

else:
adataobs = None

if any(item in color for item in list(adata.var.index)):
# find the index of the marker
marker_index = np.where(np.isin(list(adata.var.index), color))[0]
if use_layer is not None:
adatavar = adata.layers[use_layer][:, np.r_[marker_index]]
if layer is not None:
adatavar = adata.layers[layer][:, np.r_[marker_index]]
elif use_raw is True:
adatavar = adata.raw.X[:, np.r_[marker_index]]
else:
Expand Down

0 comments on commit 90ed47f

Please sign in to comment.