Skip to content

Commit

Permalink
Merge pull request #190 from bento-platform/feat/v14/phenov2
Browse files Browse the repository at this point in the history
feat: Phenopacket V2
  • Loading branch information
v-rocheleau authored Nov 28, 2023
2 parents e57ab1d + 99dfa1f commit b28fc24
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 21 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ that make up the Bento platform.

## Migration documents

* [v14 to v15](./docs/migrating_to_15.md)
* [v13 to v14](./docs/migrating_to_14.md)
* [v12 to v13](./docs/migrating_to_13.md)
* [v2.11 to v12](./docs/migrating_to_12.md)
Expand Down Expand Up @@ -631,6 +632,27 @@ Note: the CORS instructions have already been taken care of in the `docker-compo

![Elasticvue login](docs/img/elasticview_login.png)


### Converting Phenopackets

Phenopackets JSON documents can be converted from [V1](https://phenopacket-schema.readthedocs.io/en/1.0.0/toplevel.html)
to [V2](https://phenopacket-schema.readthedocs.io/en/2.0.0/toplevel.html) using `bentoctl` and
[Phenopacket-tools](https://github.com/phenopackets/phenopacket-tools) as its backend.

For the `bentoctl convert-pheno` command to work, you need to:
1. [Download](http://phenopackets.org/phenopacket-tools/stable/tutorial.html#download-phenopacket-tools) a Phenopacket-tools release.
2. Unzip its content and place the .jar file somwhere safe.
3. Specify the .jar path in `local.env` with the `PHENOTOOL_JAR_PATH` variable

You can then convert a file with:
```shell
bentoctl convert-pheno <source> <target>
```

If the `target` argument is not provided, `bentoctl` will append "_pheno_v2" to the source file's name and save it in its
parent directory.


<br />

## Testing
Expand Down
21 changes: 21 additions & 0 deletions docs/migrating_to_15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Migrating to Bento v15

Bento v15 migrates to Phenopackets v2, and as such requires that Phenopackets are updated and re-ingested.

Before updating, perform the following steps:

* Shut down Bento with `./bentoctl.bash stop`
* Remove the Katsu data volume
* Remove the WES data volume

Then, update your instance:

```bash
./bentoctl.bash pull
```

Finally, restart Bento:

```bash
./bentoctl.bash start
```
24 changes: 12 additions & 12 deletions etc/bento.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BENTOV2_GATEWAY_INTERNAL_CERTS_DIR=/usr/local/openresty/nginx/certs

# Gateway
BENTOV2_GATEWAY_IMAGE=ghcr.io/bento-platform/bento_gateway
BENTOV2_GATEWAY_VERSION=0.7.1
BENTOV2_GATEWAY_VERSION=0.8.0
BENTOV2_GATEWAY_VERSION_DEV=${BENTOV2_GATEWAY_VERSION}-dev
BENTOV2_GATEWAY_CONTAINER_NAME=${BENTOV2_PREFIX}-gateway

Expand Down Expand Up @@ -75,7 +75,7 @@ BENTO_AUTH_DB_NETWORK="${BENTOV2_PREFIX}-auth-db-net"

# - Authz service
BENTO_AUTHZ_IMAGE=ghcr.io/bento-platform/bento_authorization_service
BENTO_AUTHZ_VERSION=0.4.0
BENTO_AUTHZ_VERSION=0.5.0
BENTO_AUTHZ_VERSION_DEV=${BENTO_AUTHZ_VERSION}-dev
BENTO_AUTHZ_CONTAINER_NAME=${BENTOV2_PREFIX}-authz
BENTO_AUTHZ_NETWORK=${BENTOV2_PREFIX}-authz-net
Expand All @@ -95,7 +95,7 @@ BENTO_AUTHZ_DB_MEM_LIM=1G
# Web
BENTO_WEB_CUSTOM_HEADER=
BENTOV2_WEB_IMAGE=ghcr.io/bento-platform/bento_web
BENTOV2_WEB_VERSION=3.2.2
BENTOV2_WEB_VERSION=edge
BENTOV2_WEB_VERSION_DEV=${BENTOV2_WEB_VERSION}-dev
BENTOV2_WEB_CONTAINER_NAME=${BENTOV2_PREFIX}-web
BENTO_WEB_NETWORK=${BENTOV2_PREFIX}-web-net
Expand All @@ -107,7 +107,7 @@ BENTOV2_WEB_CPUS=2

# Drop-Box
BENTOV2_DROP_BOX_IMAGE=ghcr.io/bento-platform/bento_drop_box_service
BENTOV2_DROP_BOX_VERSION=1.0.1
BENTOV2_DROP_BOX_VERSION=1.1.1
BENTOV2_DROP_BOX_VERSION_DEV=${BENTOV2_DROP_BOX_VERSION}-dev
BENTOV2_DROP_BOX_CONTAINER_NAME=${BENTOV2_PREFIX}-drop-box
BENTO_DROP_BOX_NETWORK=${BENTOV2_PREFIX}-drop-box-net
Expand All @@ -121,7 +121,7 @@ BENTOV2_DROP_BOX_CPUS=3

# Service Registry
BENTOV2_SERVICE_REGISTRY_IMAGE=ghcr.io/bento-platform/bento_service_registry
BENTOV2_SERVICE_REGISTRY_VERSION=1.2.2
BENTOV2_SERVICE_REGISTRY_VERSION=1.3.1
BENTOV2_SERVICE_REGISTRY_VERSION_DEV=${BENTOV2_SERVICE_REGISTRY_VERSION}-dev
BENTOV2_SERVICE_REGISTRY_CONTAINER_NAME=${BENTOV2_PREFIX}-service-registry
BENTO_SERVICE_REGISTRY_NETWORK=${BENTOV2_PREFIX}-service-registry-net
Expand All @@ -133,7 +133,7 @@ BENTOV2_SERVICE_REGISTRY_CPUS=1

# Notification
BENTOV2_NOTIFICATION_IMAGE=ghcr.io/bento-platform/bento_notification_service
BENTOV2_NOTIFICATION_VERSION=3.0.1
BENTOV2_NOTIFICATION_VERSION=3.1.0
BENTOV2_NOTIFICATION_VERSION_DEV=${BENTOV2_NOTIFICATION_VERSION}-dev
BENTOV2_NOTIFICATION_CONTAINER_NAME=${BENTOV2_PREFIX}-notification
BENTO_NOTIFICATION_NETWORK=${BENTOV2_PREFIX}-notification-net
Expand Down Expand Up @@ -163,7 +163,7 @@ BENTOV2_AGGREGATION_CPUS=2

# Event-Relay
BENTOV2_EVENT_RELAY_IMAGE=ghcr.io/bento-platform/bento_event_relay
BENTOV2_EVENT_RELAY_VERSION=3.0.2
BENTOV2_EVENT_RELAY_VERSION=3.1.0
BENTOV2_EVENT_RELAY_VERSION_DEV=${BENTOV2_EVENT_RELAY_VERSION}-dev
BENTOV2_EVENT_RELAY_CONTAINER_NAME=${BENTOV2_PREFIX}-event-relay
BENTO_EVENT_RELAY_NETWORK=${BENTOV2_PREFIX}-event-relay-net
Expand All @@ -176,7 +176,7 @@ BENTOV2_EVENT_RELAY_CPUS=1

# WES
BENTOV2_WES_IMAGE=ghcr.io/bento-platform/bento_wes
BENTOV2_WES_VERSION=0.11.0
BENTOV2_WES_VERSION=0.12.2
BENTOV2_WES_VERSION_DEV=${BENTOV2_WES_VERSION}-dev
BENTOV2_WES_CONTAINER_NAME=${BENTOV2_PREFIX}-wes
BENTO_WES_NETWORK=${BENTOV2_PREFIX}-wes-net
Expand All @@ -203,7 +203,7 @@ BENTOV2_WES_WORKFLOW_TIMEOUT=172800

# DRS
BENTOV2_DRS_IMAGE=ghcr.io/bento-platform/bento_drs
BENTOV2_DRS_VERSION=0.13.0
BENTOV2_DRS_VERSION=edge
BENTOV2_DRS_VERSION_DEV=${BENTOV2_DRS_VERSION}-dev
BENTOV2_DRS_CONTAINER_NAME=${BENTOV2_PREFIX}-drs
BENTO_DRS_NETWORK=${BENTOV2_PREFIX}-drs-net
Expand Down Expand Up @@ -246,7 +246,7 @@ BENTOV2_KATSU_DB_CPUS=4

# Katsu
BENTOV2_KATSU_IMAGE=ghcr.io/bento-platform/katsu
BENTOV2_KATSU_VERSION=5.0.0
BENTOV2_KATSU_VERSION=edge
BENTOV2_KATSU_VERSION_DEV=${BENTOV2_KATSU_VERSION}-dev
BENTOV2_KATSU_CONTAINER_NAME=${BENTOV2_PREFIX}-katsu
BENTO_KATSU_NETWORK=${BENTOV2_PREFIX}-katsu-net
Expand Down Expand Up @@ -289,7 +289,7 @@ BENTOV2_GOHAN_DATA_ROOT=${BENTOV2_ROOT_DATA_DIR}/gohan

# -- API
BENTOV2_GOHAN_API_IMAGE=ghcr.io/bento-platform/gohan-api
BENTOV2_GOHAN_API_VERSION=4.0.1
BENTOV2_GOHAN_API_VERSION=pr-57
BENTOV2_GOHAN_API_VERSION_DEV=${BENTOV2_GOHAN_API_VERSION}-dev

BENTOV2_GOHAN_API_CONTAINER_NAME=${BENTOV2_PREFIX}-gohan-api
Expand Down Expand Up @@ -369,7 +369,7 @@ BENTO_PUBLIC_TRANSLATED=true
BENTO_BEACON_CONTAINER_NAME=${BENTOV2_PREFIX}-beacon
BENTO_BEACON_NETWORK=${BENTOV2_PREFIX}-beacon-net
BENTO_BEACON_IMAGE=ghcr.io/bento-platform/bento_beacon
BENTO_BEACON_VERSION=0.11.0
BENTO_BEACON_VERSION=pr-63
BENTO_BEACON_VERSION_DEV=${BENTO_BEACON_VERSION}-dev
BENTO_BEACON_INTERNAL_PORT=${BENTO_STD_SERVICE_INTERNAL_PORT}
BENTO_BEACON_EXTERNAL_PORT=5000
Expand Down
4 changes: 4 additions & 0 deletions etc/bento_dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ [email protected]
# e.g.:
# BENTOV2_DRS_VERSION=v0.8.0
# BENTOV2_DRS_VERSION_DEV=v0.8.0-dev

# Path to the Phenopacket-tools jar
# https://github.com/phenopackets/phenopacket-tools
PHENOTOOL_JAR_PATH=
2 changes: 2 additions & 0 deletions py_bentoctl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,5 @@ def _get_enabled_services(compose_file: str, filter_out: Tuple[str, ...] = ()) -
BENTO_ORCHESTRATION_STATE_DB_FILE = os.getenv("BENTO_ORCHESTRATION_STATE_DB", "./.bentoctl.state.db")

MULTI_SERVICE_PREFIXES = ("gohan",)

PHENOTOOL_PATH = os.getenv("PHENOTOOL_JAR_PATH", "")
18 changes: 18 additions & 0 deletions py_bentoctl/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,22 @@ def exec(args):
fh.init_cbioportal()


class ConvertPhenopacket(SubCommand):

@staticmethod
def add_args(sp):
sp.add_argument("source", type=str, help="Source Phenopackets V1 JSON document to convert")
sp.add_argument("target", nargs="?", default=None, type=str,
help="Optional target file path where to place the converted Phenopackets")

@staticmethod
def exec(args):
# import asyncio
# TODO: re-convert to async
# asyncio.run(oh.convert_phenopacket_file(args.source, args.target))
oh.convert_phenopacket_file(args.source, args.target)


def main(args: Optional[list[str]] = None) -> int:
args = args or sys.argv[1:]

Expand Down Expand Up @@ -323,6 +339,8 @@ def _add_subparser(arg: str, help_text: str, subcommand: Type[SubCommand], alias
_add_subparser("shell", "Run a shell inside an already-running service container.", Shell, aliases=("sh",))
_add_subparser("run-as-shell", "Run a shell inside a stopped service container.", RunShell)
_add_subparser("logs", "Check logs for a service.", Logs)
_add_subparser("convert-pheno",
"Convert a Phenopacket V1 JSON document to V2", ConvertPhenopacket, aliases=("conv",))

p_args = parser.parse_args(args)

Expand Down
Loading

0 comments on commit b28fc24

Please sign in to comment.