Skip to content

Commit

Permalink
Merge pull request #6 from cancervariants/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
korikuzma authored Feb 14, 2022
2 parents b50c9c0 + e258a3d commit cc1172f
Show file tree
Hide file tree
Showing 21 changed files with 2,141 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
source =
evidence/
tests/
omit =
setup.py
19 changes: 19 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[flake8]
ignore = D205, D400, I101, ANN101, ANN002, ANN003
max-line-length = 88
exclude =
.git
venv
__pycache__
source
outputs
evidence/version.py
inline-quotes = "
import-order-style = pep8
application-import-names =
evidence
tests
per-file-ignores =
tests/*:ANN001, ANN2
setup.py:F821
*__init__.py:F401
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ipython_config.py
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
Expand Down Expand Up @@ -127,3 +127,8 @@ dmypy.json

# Pyre type checker
.pyre/

pyproject.toml

# data
evidence/data/*
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.4.0
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings, flake8-quotes, flake8-import-order, flake8-annotations]
- id: check-added-large-files
- id: detect-private-key
31 changes: 31 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pydantic = "*"
requests = "*"
bravado = "*"
matplotlib = "*"
seaborn = "*"
variation-normalizer = "*"
pandas = "*"
openpyxl = "*"
xlrd = "*"
xlwt = "*"
fastapi = "*"
boto3 = "*"

[dev-packages]
evidence = {editable = true, path = "."}
pytest = "*"
pre-commit = "*"
flake8 = "*"
flake8-docstrings = "*"
flake8-quotes = "*"
flake8-annotations = "*"
flake8-import-order = "*"
coverage = "*"
pytest-cov = "*"
ipykernel = "*"
63 changes: 62 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,63 @@
# evidence-normalization
# Evidence Normalization

Service for normalizing evidence

## Developer instructions

The following sections include instructions specifically for developers.

### Installation
For a development install, we recommend using Pipenv. See the
[pipenv docs](https://pipenv-fork.readthedocs.io/en/latest/#install-pipenv-today)
for direction on installing pipenv in your compute environment.

Once installed, from the project root dir, just run:

```commandline
pipenv shell
pipenv lock && pipenv sync
```

### Backend Services

Evidence Normalization relies on [Variation Normalization](https://github.com/cancervariants/variation-normalization) for normalizing Cancer Hotspots data. You will need to setup backend services and set the appropriate environment variables. See the [README](https://github.com/cancervariants/variation-normalization#variation-normalization) for more information.


### Starting the Evidence Normalization Service Locally

To start the service, run the following:

```commandline
uvicorn evidence.main:app --reload
```

Next, view the OpenAPI docs on your local machine:
http://127.0.0.1:8000/evidence

### Init coding style tests

Code style is managed by [flake8](https://github.com/PyCQA/flake8) and checked prior to commit.

We use [pre-commit](https://pre-commit.com/#usage) to run conformance tests.

This ensures:

* Check code style
* Check for added large files
* Detect AWS Credentials
* Detect Private Key

Before first commit run:

```commandline
pre-commit install
```


### Running unit tests

Running unit tests is as easy as pytest.

```commandline
pipenv run pytest
```
30 changes: 30 additions & 0 deletions evidence/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""The VICC library for normalizing evidence"""
from pathlib import Path
from os import environ
import logging

APP_ROOT = Path(__file__).resolve().parents[0]
DATA_DIR_PATH = APP_ROOT / "data"
SEQREPO_DATA_PATH = environ.get("SEQREPO_DATA_PATH", "/usr/local/share/seqrepo/latest")

if environ.get("EVIDENCE_PROD") == "True":
ENV_NAME = "PROD"
environ["VARIATION_NORM_EB_PROD"] = "True"
environ["GENE_NORM_EB_PROD"] = "True"
else:
ENV_NAME = "DEV"

logging.basicConfig(
filename="evidence-normalizer.log",
format="[%(asctime)s] - %(name)s - %(levelname)s : %(message)s"
)
logger = logging.getLogger("evidence")
logger.setLevel(logging.DEBUG)

logging.getLogger("bravado").setLevel(logging.INFO)
logging.getLogger("bravado_core").setLevel(logging.INFO)
logging.getLogger("boto3").setLevel(logging.INFO)
logging.getLogger("botocore").setLevel(logging.INFO)
logging.getLogger("python_jsonschema_objects").setLevel(logging.INFO)
logging.getLogger("swagger_spec_validator").setLevel(logging.INFO)
logging.getLogger("urllib3").setLevel(logging.INFO)
4 changes: 4 additions & 0 deletions evidence/data_sources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Import data sources"""
from .gnomad import GnomAD
from .cbioportal import CBioPortal
from .cancer_hotspots import CancerHotspots
Loading

0 comments on commit cc1172f

Please sign in to comment.