Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.10.9
current_version = 0.11.0
commit = True

[bumpversion:file:setup.py]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conda-publish-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
target-platform: linux-64
- os: ubuntu-24.04-arm
target-platform: linux-aarch64
- os: macos-13
- os: macos-15
target-platform: osx-64
- os: macos-latest
target-platform: osx-arm64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conda-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
target-platform: linux-64
- os: ubuntu-24.04-arm
target-platform: linux-aarch64
- os: macos-13
- os: macos-15
target-platform: osx-64
- os: macos-latest
target-platform: osx-arm64
Expand Down
37 changes: 25 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
name: netZooPy

on:
push:
push:
branches:
- master
- devel
pull_request:
branches:
pull_request:
branches:
- master
- devel

jobs:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, ubuntu-latest]
python-version: [3.8, 3.9, '3.10']
matrix:
os: [macos-15, ubuntu-latest]
python-version: [3.9, '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and build package
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov codecov
echo ${{ matrix.os }}
if [[ "${{ matrix.os }}" == "macos-latest" ]];then echo "running this";brew install hdf5 c-blosc;export HDF5_DIR=/opt/homebrew/Cellar/hdf5/;export BLOSC_DIR=/opt/homebrew/Cellar/c-blosc/;fi
if [[ "${{ matrix.os }}" =~ ^macos- ]]; then
brew install hdf5 c-blosc lzo
export HDF5_DIR=$(brew --prefix hdf5)
export BLOSC_DIR=$(brew --prefix c-blosc)
export LZO_DIR=$(brew --prefix lzo)
# Set library and include paths for macOS
export LDFLAGS="-L$(brew --prefix hdf5)/lib -L$(brew --prefix c-blosc)/lib -L$(brew --prefix lzo)/lib"
export CPPFLAGS="-I$(brew --prefix hdf5)/include -I$(brew --prefix c-blosc)/include -I$(brew --prefix lzo)/include"
export PKG_CONFIG_PATH="$(brew --prefix hdf5)/lib/pkgconfig:$(brew --prefix c-blosc)/lib/pkgconfig"
fi
if [[ "${{ matrix.os }}" =~ ^ubuntu- ]]; then
sudo apt-get update
sudo apt-get install -y liblzo2-dev libhdf5-dev libblosc-dev
fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Lint with flake8
run: |
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
Expand All @@ -43,4 +56,4 @@ jobs:
pytest --cov=netZooPy tests
- name: Report coverage
run: |
codecov
codecov
2 changes: 1 addition & 1 deletion .github/workflows/test-conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
target-platform: linux-64
- os: ubuntu-24.04-arm
target-platform: linux-aarch64
- os: macos-13
- os: macos-15
target-platform: osx-64
- os: macos-latest
target-platform: osx-arm64
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ panda_remove.txt
pan_test_panda.txt
tests/lioness/dragon/lioness_dragon_results/
docs/_build/
netZooPy/panda/io.py
#netZooPy/panda/io.py
debug_bonobo.py

!recipe/
!recipe/recipe.yaml
!recipe/test.py
!recipe/test.py

pixi/*
.pixi/*
pixi*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ Please report any issues to the [issues page](https://github.com/netZoo/netZooPy

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.

Latest version: 0.10.9
Latest version: 0.11.0
4 changes: 3 additions & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: netzoopy
version: 0.10.9
version: 0.11.0

source:
path: ..
Expand All @@ -23,6 +23,7 @@ requirements:
- click
- pandas
- pytables
- pytorch
run:
- numpy>=1.19.2
- python {{ python }}
Expand All @@ -36,6 +37,7 @@ requirements:
- click
- pandas
- pytables
- pytorch

test:
commands:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
author = u'netZoo'

# The short X.Y version
__version__ = "0.10.9"
__version__ = "0.11.0"
version = ".".join(__version__.split(".")[:2])
# The full version, including alpha/beta/rc tags
release = __version__
Expand Down
3 changes: 2 additions & 1 deletion netZooPy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
from netZooPy import condor
from netZooPy import sambar
from netZooPy import bonobo
from netZooPy import giraffe

__version__ = "0.10.9"
__version__ = "0.11.0"
25 changes: 20 additions & 5 deletions netZooPy/dragon/dragon.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ def estimate_kappa_dragon(n, p1, p2, lambdas, seed, simultaneous = False):
Dlogli11 = lambda x: (1./4*p1*(p1-1)
*(sc.digamma(x/2)-sc.digamma((x-1)/2))
+term_Dlogli11)
kappa11 = optimize.bisect(Dlogli11, 1.001, 1000*n)
try:
kappa11 = optimize.bisect(Dlogli11, 1.001, 1000*n)
except ValueError:
raise Exception("[dragon.estimate_kappa_dragon] Unable to optimize kappa11, likely due to high p, low n. \n Consider use of dragon.estimate_p_values_mc instead if p is reasonably small (~1000).")
else:
kappa11 = np.nan

Expand All @@ -284,7 +287,11 @@ def estimate_kappa_dragon(n, p1, p2, lambdas, seed, simultaneous = False):
Dlogli22 = lambda x: (1./4*p2*(p2-1)
*(sc.digamma(x/2)-sc.digamma((x-1)/2))
+term_Dlogli22)
kappa22 = optimize.bisect(Dlogli22, 1.001, 1000*n)
try:
kappa22 = optimize.bisect(Dlogli22, 1.001, 1000*n)
except ValueError:
raise Exception("[dragon.estimate_kappa_dragon] Unable to optimize kappa22, likely due to high p, low n. \n Consider use of dragon.estimate_p_values_mc instead if p is reasonably small (~1000)")

else:
kappa22 = np.nan

Expand All @@ -293,7 +300,11 @@ def estimate_kappa_dragon(n, p1, p2, lambdas, seed, simultaneous = False):
Dlogli12 = lambda x: (1./2*p1*p2
*(sc.digamma(x/2)-sc.digamma((x-1)/2))
+term_Dlogli12)
kappa12 = optimize.bisect(Dlogli12, 1.001, 1000*n)
try:
kappa12 = optimize.bisect(Dlogli12, 1.001, 1000*n)
except ValueError:
raise Exception("[dragon.estimate_kappa_dragon] Unable to optimize kappa12, likely due to high p, low n. \n Consider use of dragon.estimate_p_values_mc instead if p is reasonably small (~1000)")

else:
kappa12 = np.nan

Expand Down Expand Up @@ -427,8 +438,12 @@ def assign_p_to_r(r_target, r_null, idx1, idx2, verbose=True):
if np.min(r_null)<0:
return("[netZooPy.dragon.dragon.assign_p_to_r] Error: null distribution must be absoluted before using this function")
return np.sum(r_null>np.abs(r_target))/len(r_null)



def estimate_p_values_mc(r, n, p1, p2, lambdas, seed = 1, verbose = True):
if(p1 + p2 > 2000):
print("[dragon.estimate_p_values_mc] This function may be prohibitively slow for larger values of p1 + p2. Speed improvements are work in progress. \n Consider thresholding by magnitude instead of p-values.")

lam = lambdas
r_null = MC_estimate(n, p1, p2,lam, seed)

Expand Down Expand Up @@ -496,7 +511,7 @@ def estimate_p_values_mc(r, n, p1, p2, lambdas, seed = 1, verbose = True):
# adj_pvalues_mat += adj_pvalues_mat.T

return(mc_p)

def calculate_true_R(X1, X2, Sigma):
x = np.arange(0., 1.01, 0.01)
n_lams = len(x)
Expand Down
4 changes: 4 additions & 0 deletions netZooPy/giraffe/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from __future__ import absolute_import

from .giraffe import Giraffe
from .utils import *
Loading
Loading