Skip to content

Commit

Permalink
Merge pull request #188 from Sichao25/anndata_ver
Browse files Browse the repository at this point in the history
Remove non-conda-forge package from requirement
  • Loading branch information
Xiaojieqiu authored Jun 30, 2023
2 parents 6bd4e7f + 4018309 commit cb9ec31
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@ cvxopt>=1.2.3
csbdeep>=0.6.3
descartes
dynamo-release>=1.3.0
fbgbp>=0.2.0
folium>=0.12.1
geopandas>=0.10.2
ipywidgets>=7.7.1
KDEpy>=1.1.0
kneed>=0.7.0
kornia>=0.6.4
loess>=2.1.2
loompy>=3.0.5
mapclassify>=2.4.2
matplotlib<=3.5.3
nbconvert
networkx>=2.6.3
# ngs_tools>=1.6.0
nudged>=0.3.1
numba>=0.46.0
numpy>=1.18.1
opencv-python>=4.5.4.60
Expand Down
5 changes: 4 additions & 1 deletion spateo/svg/get_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import scipy.stats
from anndata import AnnData
from dynamo.tools.sampling import sample
from loess.loess_1d import loess_1d
from scipy.sparse import csr_matrix, issparse
from scipy.stats import norm
from statsmodels.stats.multitest import multipletests
Expand Down Expand Up @@ -76,6 +75,10 @@ def svg_iden_reg(
adata.var["raw_pos_rate"]: The positive rate of each gene.
"""
try:
from loess.loess_1d import loess_1d
except ImportError:
raise ImportError("You need to install the package `loess`." "\nInstall via `pip install loess`")
w0 = cal_wass_dis_nobs(
adata,
bin_size=1,
Expand Down
22 changes: 15 additions & 7 deletions tests/segmentation/test_bp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ def test_create_neighbor_offsets(self):
def test_cell_marginals(self):
background_probs = np.full((10, 10), 0.1)
cell_probs = np.full((10, 10), 0.9)
marginals = bp.cell_marginals(background_probs, cell_probs, p=0.7, q=0.3)
np.testing.assert_allclose(np.ones((10, 10)), marginals, atol=0.05)
try:
marginals = bp.cell_marginals(background_probs, cell_probs, p=0.7, q=0.3)
np.testing.assert_allclose(np.ones((10, 10)), marginals, atol=0.05)
except ImportError:
pass

def test_run_bp(self):
rng = np.random.default_rng(2021)
Expand All @@ -33,8 +36,13 @@ def test_run_bp(self):

expected = np.zeros((20, 20))
expected[5:15, 5:15] = 1
np.testing.assert_allclose(
expected,
bp.run_bp(stats.nbinom(n=10, p=0.5).pmf(X), stats.nbinom(n=100, p=0.5).pmf(X), square=True, p=0.7, q=0.3),
atol=1e-3,
)
try:
np.testing.assert_allclose(
expected,
bp.run_bp(
stats.nbinom(n=10, p=0.5).pmf(X), stats.nbinom(n=100, p=0.5).pmf(X), square=True, p=0.7, q=0.3
),
atol=1e-3,
)
except ImportError:
pass

0 comments on commit cb9ec31

Please sign in to comment.