Skip to content

Commit

Permalink
feat: initial training implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Sep 7, 2023
1 parent 28f7df1 commit 10d3a7c
Show file tree
Hide file tree
Showing 23 changed files with 413 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/data/train_smoke/* filter=lfs diff=lfs merge=lfs -text
4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: "0"
lfs: 'true'

- name: Log in to the Container registry
uses: docker/login-action@v2
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
lfs: 'true'

- name: Install Python
uses: actions/setup-python@v2
Expand All @@ -47,7 +49,9 @@ jobs:
sphinx-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
lfs: 'true'

- name: Install Python
uses: actions/setup-python@v2
Expand Down Expand Up @@ -76,9 +80,9 @@ jobs:
- '3.11'
needs: linting
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # we need tags for versioneer to work
lfs: 'true'

- name: Install Python
uses: actions/setup-python@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
package-name: cada-prio
token: ${{ secrets.BOT_TOKEN }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
with:
fetch-depth: 0
lfs: 'true'

- name: Set up Python
if: ${{ steps.release.outputs.release_created }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/model-out

*~
.*.sw?

Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Types of Contributions
Report Bugs
===========

Report bugs at https://github.com/bihealth/cada-ng/issues.
Report bugs at https://github.com/bihealth/cada-prio/issues.

If you are reporting a bug, please include:

Expand All @@ -39,12 +39,12 @@ Anything tagged with "enhancement" and "help wanted" is open to whoever wants to
Write Documentation
===================

cada-ng could always use more documentation, whether as part of the official cada-ng docs, in docstrings, or even on the web in blog posts, articles, and such.
cada-prio could always use more documentation, whether as part of the official cada-prio docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback
===============

The best way to send feedback is to file an issue at https://github.com/bihealth/cada-ng/issues.
The best way to send feedback is to file an issue at https://github.com/bihealth/cada-prio/issues.

If you are proposing a feature:

Expand All @@ -56,18 +56,18 @@ If you are proposing a feature:
Get Started!
------------

Ready to contribute? Here's how to set up `cada-ng` for local development.
Ready to contribute? Here's how to set up `cada-prio` for local development.

1. Fork the `cada-ng` repo on GitHub.
1. Fork the `cada-prio` repo on GitHub.
2. Clone your fork locally::

$ git clone git@github.com:bihealth/cada-ng.git
$ git clone git@github.com:bihealth/cada-prio.git

3. Install your local copy into a virtualenv.
Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::

$ mkvirtualenv cada-ng
$ cd cada-ng/
$ mkvirtualenv cada-prio
$ cd cada-prio/
$ python setup.py develop

4. Create a branch for local development::
Expand All @@ -79,7 +79,7 @@ Ready to contribute? Here's how to set up `cada-ng` for local development.
5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::

$ flake8 cada-ng tests
$ flake8 cada-prio tests
$ python setup.py test or pytest
$ tox

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[![CI](https://github.com/bihealth/cada-ng/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/bihealth/cada-ng/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/bihealth/cada-ng/graph/badge.svg?token=HIBwaG4eYM)](https://codecov.io/gh/bihealth/cada-ng)
[![Documentation Status](https://readthedocs.org/projects/cada-ng/badge/?version=latest)](https://cada-ng.readthedocs.io/en/latest/?badge=latest)
[![Pypi](https://img.shields.io/pypi/pyversions/cada-ng.svg)](https://pypi.org/project/cada-ng)
[![CI](https://github.com/bihealth/cada-prio/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/bihealth/cada-prio/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/bihealth/cada-prio/graph/badge.svg?token=HIBwaG4eYM)](https://codecov.io/gh/bihealth/cada-prio)
[![Documentation Status](https://readthedocs.org/projects/cada-prio/badge/?version=latest)](https://cada-prio.readthedocs.io/en/latest/?badge=latest)
[![Pypi](https://img.shields.io/pypi/pyversions/cada-prio.svg)](https://pypi.org/project/cada-prio)

# CADA: The Next Generation

This is a re-implementation of the [CADA](https://github.com/Chengyao-Peng/CADA) method for phenotype-similarity prioritization.

- Free software: MIT license
- Documentation: https://cada-ng.readthedocs.io/en/latest/
- Discussion Forum: https://github.com/bihealth/cada-ng/discussions
- Bug Reports: https://github.com/bihealth/cada-ng/issues
- Documentation: https://cada-prio.readthedocs.io/en/latest/
- Discussion Forum: https://github.com/bihealth/cada-prio/discussions
- Bug Reports: https://github.com/bihealth/cada-prio/issues


## Managing GitHub Project with Terraform
Expand All @@ -22,7 +22,7 @@ This is a re-implementation of the [CADA](https://github.com/Chengyao-Peng/CADA)
# cd utils/terraform
# terraform init
# terraform import github_repository.cada-ng cada-ng
# terraform import github_repository.cada-prio cada-prio
# terraform validate
# terraform fmt
# terraform plan
Expand Down
30 changes: 29 additions & 1 deletion cada_prio/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import click

from cada_prio import _version
from cada_prio import _version, train_model


@click.group()
Expand All @@ -13,3 +13,31 @@ def cli(ctx: click.Context, verbose: bool):
"""Main entry point for CLI via click."""
ctx.ensure_object(dict)
ctx.obj["verbose"] = verbose


@cli.command("train-model")
@click.argument("path_out", type=str)
@click.option("--path-hgnc-json", type=str, help="path to HGNC JSON", required=True)
@click.option(
"--path-gene-hpo-links", type=str, help="path to gene-HPO term links JSONL", required=True
)
@click.option(
"--path-hpo-genes-to-phenotype",
type=str,
help="path to genes_to_phenotype.txt file",
required=True,
)
@click.option("--path-hpo-obo", type=str, help="path HPO OBO file", required=True)
@click.pass_context
def cli_train_model(
ctx: click.Context,
path_out: str,
path_hgnc_json: str,
path_gene_hpo_links: str,
path_hpo_genes_to_phenotype: str,
path_hpo_obo: str,
):
ctx.ensure_object(dict)
train_model.run(
path_out, path_hgnc_json, path_gene_hpo_links, path_hpo_genes_to_phenotype, path_hpo_obo
)

0 comments on commit 10d3a7c

Please sign in to comment.