Skip to content

Commit be38ffe

Browse files
authored
Merge pull request #27 from lozuponelab/travis2githubactions
Travis2githubactions
2 parents b4465f3 + 22780aa commit be38ffe

File tree

8 files changed

+114
-48
lines changed

8 files changed

+114
-48
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/main.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Tests
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
14+
# This allows a subsequently queued workflow run to interrupt previous runs
15+
concurrency:
16+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
python-version: ["3.8", "3.9", "3.10"]
26+
# Set it to default use bash in interactive mode (required for miniconda setup)
27+
defaults:
28+
run:
29+
shell: bash -el {0}
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
- name: create environment with mamba
37+
uses: conda-incubator/setup-miniconda@v2
38+
with:
39+
mamba-version: "*"
40+
python-version: ${{ matrix.python-version }}
41+
channels: conda-forge,bioconda,defaults
42+
auto-activate-base: false
43+
environment-file: environment.yml
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install pytest
48+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
49+
python setup.py install
50+
51+
- name: Test with pytest
52+
run: |
53+
python -m pytest tests/

.github/workflows/python-publish.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.x'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI }}
40+
verbose: true

.travis.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

SCNIC/annotate_correls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def do_annotate_correls(correls_loc, tre_loc, genome_loc, module_loc, output_loc
154154
correls_tip_tips = tre.tip_tip_distances(set([otu for otu_pair in correls.index for otu in otu_pair]))
155155
print("read tree")
156156
genome_frame = pd.read_csv(genome_loc, sep='\t', index_col=0)
157-
genome_table = genome_frame_to_table(genome_frame, set([otu for otu_pair in correls.index for otu in otu_pair]))
157+
genome_table = genome_frame_to_table(genome_frame, list(set([otu for otu_pair in correls.index for otu in otu_pair])))
158158
print("read table")
159159
if modules_to_keep_loc is not None:
160160
modules_to_keep = get_modules_to_keep(modules_to_keep_loc)

environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dependencies:
1414
- python=3
1515
- fastspar>=0.0.7
1616
- armadillo=8
17+
- seaborn
18+
- tqdm
1719
- pip:
1820
- scipy<=1.10.1,>=1.8.0
1921
- SCNIC

requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
numpy
2+
networkx>=2
3+
biom-format
4+
pandas>=1
5+
scikit-bio
6+
statsmodels
7+
h5py
8+
tqdm

tests/test_between_correls.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from SCNIC.general import simulate_correls
33
from SCNIC.between_correls import between_correls
44
from biom.util import biom_open
5+
import pytest
56

67

78
def test_between_correls(tmpdir):
@@ -13,7 +14,14 @@ def test_between_correls(tmpdir):
1314
with biom_open(str(loc.join("table2.biom")), 'w') as f:
1415
table2.to_hdf5(f, 'madebyme')
1516
os.chdir(str(loc))
16-
between_correls('table1.biom', 'table2.biom', 'out_dir', correl_method='pearson', max_p=.1)
17-
files = os.listdir(str(loc)+'/out_dir')
17+
18+
# P value based module making is not yet implemented, check this
19+
with pytest.raises(Exception) as exc_info:
20+
between_correls('table1.biom', 'table2.biom', 'out_dir', correl_method='pearson', max_p=.1)
21+
assert exc_info.value.args[0] == "SCNIC does not currently support module making based on p-values."
22+
23+
# Run with min r threshold and check that files exist
24+
between_correls('table1.biom', 'table2.biom', 'out_dir_2', correl_method='pearson', min_r=.2)
25+
files = os.listdir(str(loc)+'/out_dir_2')
1826
assert "correls.txt" in files
1927
assert "crossnet.gml" in files

0 commit comments

Comments
 (0)