Skip to content

Commit

Permalink
Merge pull request #27 from lozuponelab/travis2githubactions
Browse files Browse the repository at this point in the history
Travis2githubactions
  • Loading branch information
sterrettJD authored Sep 5, 2024
2 parents b4465f3 + 22780aa commit be38ffe
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 48 deletions.
8 changes: 0 additions & 8 deletions .bumpversion.cfg

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Tests

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

permissions:
contents: read
pull-requests: read

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
# Set it to default use bash in interactive mode (required for miniconda setup)
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: create environment with mamba
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
python-version: ${{ matrix.python-version }}
channels: conda-forge,bioconda,defaults
auto-activate-base: false
environment-file: environment.yml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python setup.py install
- name: Test with pytest
run: |
python -m pytest tests/
40 changes: 40 additions & 0 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI }}
verbose: true
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion SCNIC/annotate_correls.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def do_annotate_correls(correls_loc, tre_loc, genome_loc, module_loc, output_loc
correls_tip_tips = tre.tip_tip_distances(set([otu for otu_pair in correls.index for otu in otu_pair]))
print("read tree")
genome_frame = pd.read_csv(genome_loc, sep='\t', index_col=0)
genome_table = genome_frame_to_table(genome_frame, set([otu for otu_pair in correls.index for otu in otu_pair]))
genome_table = genome_frame_to_table(genome_frame, list(set([otu for otu_pair in correls.index for otu in otu_pair])))
print("read table")
if modules_to_keep_loc is not None:
modules_to_keep = get_modules_to_keep(modules_to_keep_loc)
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ dependencies:
- python=3
- fastspar>=0.0.7
- armadillo=8
- seaborn
- tqdm
- pip:
- scipy<=1.10.1,>=1.8.0
- SCNIC
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
numpy
networkx>=2
biom-format
pandas>=1
scikit-bio
statsmodels
h5py
tqdm
12 changes: 10 additions & 2 deletions tests/test_between_correls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from SCNIC.general import simulate_correls
from SCNIC.between_correls import between_correls
from biom.util import biom_open
import pytest


def test_between_correls(tmpdir):
Expand All @@ -13,7 +14,14 @@ def test_between_correls(tmpdir):
with biom_open(str(loc.join("table2.biom")), 'w') as f:
table2.to_hdf5(f, 'madebyme')
os.chdir(str(loc))
between_correls('table1.biom', 'table2.biom', 'out_dir', correl_method='pearson', max_p=.1)
files = os.listdir(str(loc)+'/out_dir')

# P value based module making is not yet implemented, check this
with pytest.raises(Exception) as exc_info:
between_correls('table1.biom', 'table2.biom', 'out_dir', correl_method='pearson', max_p=.1)
assert exc_info.value.args[0] == "SCNIC does not currently support module making based on p-values."

# Run with min r threshold and check that files exist
between_correls('table1.biom', 'table2.biom', 'out_dir_2', correl_method='pearson', min_r=.2)
files = os.listdir(str(loc)+'/out_dir_2')
assert "correls.txt" in files
assert "crossnet.gml" in files

0 comments on commit be38ffe

Please sign in to comment.