Skip to content

Commit

Permalink
Merge pull request #101 from databio/dev
Browse files Browse the repository at this point in the history
release 0.4.0
  • Loading branch information
khoroshevskyi authored Apr 8, 2024
2 parents 30fdad3 + b7e48f7 commit e238aca
Show file tree
Hide file tree
Showing 144 changed files with 12,899 additions and 11,298 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ bedhost/static/bedhost-ui/
# For building
geniml

local_cache
local_cache

environment/
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: FastAPI",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": ["bedhost.main:app", "--reload"],
"jinja": true,
"justMyCode": false
}
]
}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ COPY . /app

RUN python -m pip install --upgrade pip

# Need this command due to geniml dependency on hnswlib
ENV HNSWLIB_NO_NATIVE=1
RUN apt-get install -y python3-dev
RUN apt-get install -y build-essential

# Install CPU-only pytorch, eliminating huge nvidia dependencies
RUN pip install torch==2.1.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install https://github.com/pepkit/pipestat/archive/refs/heads/dev.zip
Expand Down
2 changes: 1 addition & 1 deletion bedhost/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.0"
__version__ = "0.4.0"
7 changes: 2 additions & 5 deletions bedhost/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from . import PKG_NAME
from ._version import __version__
from ubiquerg import VersionInHelpParser
from yacman import select_config
from bbconf.const import CFG_ENV_VARS


def build_parser():
Expand All @@ -12,7 +10,7 @@ def build_parser():
:return argparse.ArgumentParser
"""

env_var_val = select_config(config_env_vars=CFG_ENV_VARS)
# env_var_val = select_config(config_env_vars=CFG_ENV_VARS)

banner = "%(prog)s - REST API for the bedstat pipeline produced statistics"
additional_description = (
Expand Down Expand Up @@ -45,7 +43,6 @@ def add_subparser(cmd, description):
required=False,
dest="config",
help="A path to the bedhost config file (YAML). If not provided, "
f"the first available environment variable among: {', '.join(CFG_ENV_VARS)} will be used if set."
f" Currently: {env_var_val}",
f"the first available environment variable among: {', '.join(CFG_ENV_VARS)} will be used if set.",
)
return parser
29 changes: 2 additions & 27 deletions bedhost/const.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import os
from enum import Enum
from platform import python_version

from bbconf import __version__ as bbconf_v

from ._version import __version__ as SERVER_VERSION

PKG_NAME = "bedhost"
LOG_FORMAT = "%(levelname)s in %(funcName)s: %(message)s"

# for now bedstat version is hard coded
ALL_VERSIONS = {
Expand All @@ -16,30 +13,8 @@
"python_version": python_version(),
}
TEMPLATES_DIRNAME = "templates"
TEMPLATES_PATH = os.path.join(
os.path.dirname(os.path.abspath(__file__)), TEMPLATES_DIRNAME
)
STATIC_DIRNAME = "../docs"
STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), STATIC_DIRNAME)

UI_PATH = os.path.join(os.path.dirname(__file__), "static", "bedhost-ui")

BEDFILE_API_ENDPOINT = "bedfile"
BEDSET_API_ENDPOINT = "bedset"
TYPES_MAPPING = {"integer": "integer", "number": "double", "string": "string"}
VALIDATIONS_MAPPING = {
"integer": {"min": 0, "step": 1},
"number": {"min": 0, "step": 0.01},
"string": None,
}


class FIG_FORMAT(str, Enum):
png = "png"
pdf = "pdf"


class TABLE_NAME(str, Enum):
bedfiles = "bedfiles"
bedsets = "bedsets"
bedset_bedfiles = "bedset_bedfiles"
EXAMPLE_BED = "bbad85f21962bb8d972444f7f9a3a932"
EXAMPLE_BEDSET = "gse218680"
54 changes: 25 additions & 29 deletions bedhost/data_models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from typing import Dict, List, Union, Any
from fastapi import Path
from pydantic import BaseModel
from enum import Enum
from .model_parser import yaml_to_pydantic
from .main import bbc

RemoteClassEnum = Enum(
"RemoteClassEnum",
Expand All @@ -27,42 +24,41 @@ class BedList(BaseModel):
# example=ex_bed_digest,
)

chromosome_number = Path(
CROM_NUMBERS = Path(
...,
description="Chromosome number",
regex=r"^\S+$",
example=ex_chr,
)


class BedsetResponse(BaseModel):
bedset_record_id: str
number_of_bedfiles: int
bedfile_metadata: List[Dict]
class Type(BaseModel):
group: str
artifact: str
version: str


BedFile = yaml_to_pydantic("BedFile", bbc.bed._schema_path)
class Organization(BaseModel):
name: str
url: str


class BedMetadataResponse(BaseModel):
record_identifier: str
metadata: BedFile
raw: Union[Dict[str, Any], None] = None
class ComponentVersions(BaseModel):
bedhost_version: str
bbconf_version: str
python_version: str
openapi_version: str


class RecordsIdReturn(BaseModel):
record_identifier: str = None
name: Union[str, None] = (None,)


class ListBedFilesResponse(BaseModel):
total_size: int
page_size: int
next_page_token: int
records: List[RecordsIdReturn]


class BedSetMetadataResponse(BaseModel):
record_identifier: str
metadata: yaml_to_pydantic("BedSet", bbc.bedset._schema_path)
raw: Union[Dict[str, Any], None] = None
class ServiceInfoResponse(BaseModel):
id: str
name: str
type: Type
description: str
organization: Organization
contactUrl: str
documentationUrl: str
updatedAt: str
environment: str
version: str
component_versions: ComponentVersions
Loading

0 comments on commit e238aca

Please sign in to comment.