Skip to content
Open
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
63 changes: 35 additions & 28 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: CI

on:
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming
# Existing codes likely still have "master" as the primary branch
# Both are tracked here to keep legacy and new codes working
# The cookiecutter uses the "--initial-branch" flag when it runs git-init
push:
branches:
- "main"
Expand All @@ -18,47 +17,45 @@ on:

jobs:
test:
name: Pytest
runs-on: ${{ matrix.cfg.os }}
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
cfg:
- os: ubuntu-latest
python-version: "3.7"
- os: ubuntu-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.7"
- os: windows-latest
python-version: "3.7"
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: [3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v3

- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
- uses: conda-incubator/setup-miniconda@v2

# More info on options: https://github.com/marketplace/actions/provision-with-micromamba
- uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.cfg.python-version }}
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: test
environment-file: devtools/conda-envs/test_env.yaml
environment-name: test
channels: conda-forge,defaults
extra-specs: |
python=${{ matrix.python-version }}

- name: Install package
# conda setup requires this special shell
shell: bash -l {0}
run: |
python -m pip install . --no-deps
conda list
- name: Run package tests
micromamba list

- name: Run tests
# conda setup requires this special shell
shell: bash -l {0}
run: |
pytest -v --cov=kissim --cov-report=xml --cov-config=setup.cfg --color=yes kissim/tests/
pytest -v --cov=kissim --cov-report=xml --color=yes kissim/tests/

- name: Run docs notebooks tests (on Linux only)
shell: bash -l {0}
run: |
Expand All @@ -68,6 +65,7 @@ jobs:
else
echo "Do not run notebooks under $RUNNER_OS"
fi

- name: CodeCov
uses: codecov/codecov-action@v1
with:
Expand All @@ -81,25 +79,29 @@ jobs:
CI_OS: ubuntu-latest
PACKAGE: "kissim"
PYVER: "3.8"

steps:
- name: Checkout the code
uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2

- uses: mamba-org/setup-micromamba@v1
with:
python-version: "3.8"
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: test
environment-file: devtools/conda-envs/test_env.yaml
environment-name: test
channels: conda-forge,defaults
extra-specs: |
python=3.8

- name: Install linter and formatter
shell: bash -l {0}
run: |
conda install -y pylint black
micromamba install -y pylint black

- name: Run pylint
shell: bash -l {0}
run: |
pylint $PACKAGE/

- name: Run black check
shell: bash -l {0}
if: always()
Expand All @@ -108,17 +110,22 @@ jobs:

lint-format-notebooks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v2

- name: Install notebook linter and formatter
run: |
python -m pip install black-nb
python -m pip install flake8-nb

- name: Run black-nb
shell: bash
run: |
black-nb -l 99 --check docs/tutorials/*ipynb

- name: Run flake8-nb
shell: bash
run: |
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,36 @@ jobs:
docs:
name: Docs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2

- uses: mamba-org/setup-micromamba@v1
with:
python-version: "3.8"
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: test
environment-file: devtools/conda-envs/test_env.yaml
environment-name: test
channels: conda-forge,defaults
extra-specs: |
python=3.8

- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a

- name: Install package
shell: bash -l {0}
run: |
pip install . --no-deps -vv

- name: Environment Information
shell: bash -l {0}
run: |
conda info --all
conda list

- name: Run Sphinx
shell: bash -l {0}
run: |
Expand Down
8 changes: 4 additions & 4 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ channels:
- conda-forge
- defaults
dependencies:
# Base depends
- python>=3.6
# Base depends
- python>=3.8
- pip
# Package dependencies
- tqdm
Expand Down Expand Up @@ -32,5 +32,5 @@ dependencies:
- black
- pylint
- pip:
- black-nb
- flake8-nb
- black-nb
- flake8-nb
41 changes: 0 additions & 41 deletions devtools/legacy-miniconda-setup/before_install.sh

This file was deleted.

6 changes: 5 additions & 1 deletion kissim/comparison/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,22 @@ def kinase_distances(structure_distances, by="minimum", coverage_min=0.0):
data = structure_distances

# Filter by coverage
data = data[data["bit_coverage"] >= coverage_min].reset_index(drop=True)
data = data[data["bit_coverage"] >= coverage_min]
# Select relevant columns
data = data[["kinase.1", "kinase.2", "distance", "bit_coverage"]]
# Note: Kinase pair names must be sorted alphabetically to allow grouping by kinase pair names
kinase_pair_alphabetically_sorted = (
pd.Series(zip(data["kinase.1"], data["kinase.2"])).map(list).map(sorted)
)
data[["kinase.1", "kinase.2"]] = kinase_pair_alphabetically_sorted.to_list()
# Group by kinase pair names (which have been alphabetically sorted before!)
print(data)
structure_distances_grouped_by_kinases = data.groupby(by=["kinase.1", "kinase.2"], sort=False)

# Get distance values per kinase pair based on given condition
# Note: For min/max we'd like to know which structure pairs were selected!
by_terms = "minimum maximum mean median size std".split()
print(structure_distances_grouped_by_kinases)

if by == "minimum":
kinase_distances = data.iloc[
Expand Down