Skip to content

Commit

Permalink
Merge pull request #22 from instituteofcancerresearch/python-dev
Browse files Browse the repository at this point in the history
Python dev
  • Loading branch information
bkmarzouk authored Oct 25, 2023
2 parents 277921e + 7ee4a04 commit 386e2fe
Show file tree
Hide file tree
Showing 50 changed files with 13,899 additions and 687 deletions.
62 changes: 19 additions & 43 deletions .github/workflows/dev_tests.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,38 @@
name: SOPRANO (Dev) Tests

on:
push:
branches:
- python-dev
pull_request:
branches:
- python-dev

jobs:
lint:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
name: lint with python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ruff and black
run: |
python -m pip install --upgrade pip
pip install ruff black
- name: Lint check with ruff
run: |
ruff --format=github --target-version=py311 --line-length 79 .
- name: Style check with black
run: |
black ./ --check --line-length 79
test:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
name: test with python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: Development tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: src/SOPRANO/local.yml
init-shell: bash
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge
python-version: 3.11
activate-environment: soprano-dev
environment-file: src/SOPRANO/ci_linux.yml
use-mamba: true
- name: Install SOPRANO
shell: bash -l {0}
run: |
micromamba activate soprano-dev
conda activate soprano-dev
pip install -e .[ci]
- name: Test conda environment
shell: bash -l {0}
run: |
micromamba activate soprano-dev
pytest tests/test_configuration
conda activate soprano-dev
pytest -s tests/test_configuration
- name: Test units
shell: bash -l {0}
run: |
micromamba activate soprano-dev
pytest tests/test_units
conda activate soprano-dev
pytest -s tests/test_units
23 changes: 23 additions & 0 deletions .github/workflows/lint_and_style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint and style check

on: [ push ]

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install ruff and black
run: |
python -m pip install --upgrade pip
pip install ruff black
- name: Lint check with ruff
run: |
ruff --target-version=py311 --line-length 79 .
- name: Style check with black
run: |
black ./ --check --line-length 79
69 changes: 21 additions & 48 deletions .github/workflows/main_tests.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,42 @@
name: SOPRANO (Main) Tests
name: SOPRANO Tests

on:
push:
branches:
- python
- master
pull_request:
branches:
- python
- master
- main

jobs:
lint:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
name: lint with python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ruff and black
run: |
python -m pip install --upgrade pip
pip install ruff black
- name: Lint check with ruff
run: |
ruff --format=github --target-version=py311 --line-length 79 .
- name: Style check with black
run: |
black ./ --check --line-length 79
test:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.11"]
name: test with python ${{ matrix.python-version }} on ${{ matrix.os }}
os: [ "ubuntu-latest", "macos-latest" ]
name: Development tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: src/SOPRANO/local.yml
init-shell: bash
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge
python-version: 3.11
activate-environment: soprano-dev
environment-file: src/SOPRANO/ci_osx.yml # additional coreutils
use-mamba: true
- name: Install SOPRANO
shell: bash -l {0}
run: |
micromamba activate soprano-dev
conda activate soprano-dev
pip install -e .[ci]
- name: Test conda environment
shell: bash -l {0}
run: |
micromamba activate soprano-dev
pytest tests/test_configuration
conda activate soprano-dev
pytest -s tests/test_configuration
- name: Test units
shell: bash -l {0}
run: |
micromamba activate soprano-dev
pytest tests/test_units
# - name: Test integration # TODO: Need to think about this
# shell: bash -l {0}
# run: |
# micromamba activate soprano-dev
# pytest tests/test_integrations
conda activate soprano-dev
pytest -s tests/test_units
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ src/SOPRANO/data/homo_sapiens/**/Homo_sapiens.GRCh*.fa.gz
/example_output.txt

# App output files
pipeline_cache/
pipeline_cache/

# User defined app sources
app_sources/
!app_sources/annotated_inputs/.gitkeep
!app_sources/coordinate_files/.gitkeep
!app_sources/immunopeptidomes/.gitkeep

# Ignore release cache file
src/SOPRANO/data/ensembl.releases
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/python/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
pass_filenames: true
Expand All @@ -13,7 +13,8 @@ repos:
rev: 'v1.5.1'
hooks:
- id: mypy
additional_dependencies: ['types-requests']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
rev: v0.0.292
hooks:
- id: ruff
Empty file.
Empty file.
Empty file.
29 changes: 27 additions & 2 deletions docs/APP.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,40 @@ export SOPRANO_CACHE=/path/to/my/soprano/cache
soprano-app
```

### Data sources

By default, the application will serve options for the annotated mutation
and human immunopeptidome files shipped with SOPRANO. Additional files
can be detected by the application by their placement in the `./app_sources`
folders:

- `./app_sources/annotated_inputs`

VEP annotated mutation files placed in this directory will be detected,
so long as they have the extension pattern `*anno*`. E.g., `mutations.anno`
or `mutations.annotated`.


- `./app_sources/immunopeptidomes`

User defined immunopeptidomes BED files placed in this directory will be
detected, so long as they have the extension `.bed`. E.g., `immuno.bed`.


- `./app_sources/coordinate_files`

User defined BED files that can be used for randomization will be detected,
so long as they have the extension `.bed`. E.g., `randoms.bed`.


### Development status

This app is actively being developed (September 2023). The configuration is
subject to change, and additional features are soon to be integrated.

_Planned features:_

- Generalization of species. Currently only homo sapiens are supported.
- Selection of randomization regions. Currently only available via CLI.
- Generalization of species. Currently only Homo Sapiens are supported.
- Selection of transcript files. Currently only available via CLI.
- Interface for linking VEP cache files.
- Interface for downloading genome references.
Expand Down
16 changes: 11 additions & 5 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,23 @@ These arguments have short (`-s`) or long (`--long`) argument flags.
This value should be an integer greater than zero. Defaults to "-1",
implying no seed value chosen.


- `-s | --species`

- `-r | --reference`
The Latin species name associated with genome reference. The default value
is for homo_sapiens.

The name of the genome reference. Currently, this CLI supports GRCh37 and
GRCh38, which may be passed as arguments. By default, GRCh37 is chosen.

- `-a | --assembly`

- `-q | --release`
The name of the Ensembl reference genome assembly. The default value is for
GRCh38 (Homo Sapiens).


- `-r | --release`

The Ensembl release number of the genome reference
file. By default, the CLI will select release 110.
file. The default value is 110.


- `-t | --transcript`
Expand Down
27 changes: 16 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,30 @@ description = "SOPRANO: Selection On PRotein ANnotated regiOns"
readme = "README.md"
authors = [
{ name = "Luis Zapata", email = "[email protected]" },
{ name = "ICR Scientific Software Group", email = "[email protected]"},
{ name = "ICR Scientific Software Group", email = "[email protected]" },
]
maintainers = [
{ name = "Luis Zapata", email = "[email protected]" },
{ name = "ICR Scientific Software Group", email = "[email protected]"},
{ name = "ICR Scientific Software Group", email = "[email protected]" },
]
requires-python = ">=3.8"
requires-python = ">=3.10"
dependencies = [
"pandas",
"numpy",
"streamlit == 1.27.0"
"streamlit == 1.27.0",
"requests",
"types-requests",
"clint"
]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Perl",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Intended Audience :: Science/Research"
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Perl",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Intended Audience :: Science/Research"
]
dynamic = ["version"]

Expand Down Expand Up @@ -59,6 +63,7 @@ soprano-run = "SOPRANO.run:run_cli"
soprano-app = "SOPRANO.run:run_app"
soprano-get-genome = "SOPRANO.run:download_genome"
soprano-link-vep = "SOPRANO.run:link_vep_cache"
soprano-hla2ip = "SOPRANO.run:hla2pip"

[tool.hatch]
version.source = "vcs"
Expand Down
Loading

0 comments on commit 386e2fe

Please sign in to comment.