Skip to content

Commit

Permalink
Merge pull request NationalGenomicsInfrastructure#449 from ssjunnebo/…
Browse files Browse the repository at this point in the history
…deliver_ont

Upload ONT data to DDS
  • Loading branch information
ssjunnebo authored Dec 10, 2024
2 parents 1df650f + 3bbb5d9 commit dc8948e
Show file tree
Hide file tree
Showing 6 changed files with 383 additions and 12 deletions.
3 changes: 3 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# TACA Version Log

## 20241210.2
Add support for uploading ONT data to DDS

## 20241210.1

Tweaks and bugfixes for ToulligQC.
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ flowcell_parser @ git+https://github.com/SciLifeLab/flowcell_parser
pandas
python_crontab
python_dateutil
requests
setuptools
2 changes: 1 addition & 1 deletion taca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Main TACA module"""

__version__ = "1.3.0"
__version__ = "1.4.0"
74 changes: 68 additions & 6 deletions taca/delivery/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""CLI for the delivery subcommand.""" # furure todo: rename to "deliver" when fully implemented and taca-ngi-pipieline is deprecated

import logging

import click

from taca.delivery import deliver
from taca.utils.config import load_yaml_config

logger = logging.getLogger(__name__)


@click.group()
Expand All @@ -11,7 +16,7 @@ def delivery():
pass


# Stage data
### Stage data ###
@delivery.command()
@click.option(
"-f",
Expand All @@ -33,22 +38,79 @@ def stage(project, flowcells, samples):
deliver.stage(project, flowcells=flowcells_to_stage, samples=samples_to_stage)


# Upload data
### Upload data ###
@delivery.command()
@click.option(
"-s",
"--stage_dir",
type=str,
required=True,
help="Staged directory to upload",
)
@click.option(
"--order_portal",
default=None,
envvar="ORDER_PORTAL",
required=True,
type=click.File("r"),
help="Path to order portal credentials to retrieve project information",
)
@click.option(
"--statusdb_config",
default=None,
envvar="STATUS_DB_CONFIG",
required=True,
type=click.File("r"),
help="Path to statusdb config file",
)
@click.option(
"--pi_email",
default=None,
type=str,
help="PI email, to override PI email stored in order portal",
)
@click.option(
"--add_user",
multiple=True,
type=click.STRING,
help="Add additional user to DDS project. Multiple users can be given by calling this option multiple times",
)
@click.option(
"--project_description",
default=None,
type=click.STRING,
help="Override project description in order portal, e.g. if project not in order portal",
)
@click.option(
"--ignore_orderportal_members",
is_flag=True,
default=False,
help="Do not fetch member information from the order portal",
)
@click.argument("project")
def upload(project, stage_dir):
def upload(
project,
stage_dir,
statusdb_config=None,
order_portal=None,
pi_email=None,
add_user=None,
project_description=None,
ignore_orderportal_members=False,
):
"""Upload a staged project to DDS."""
deliver.upload_to_dds(project, stage_dir)
load_yaml_config(statusdb_config.name)
load_yaml_config(order_portal.name)
deliver.upload_to_dds(
project,
stage_dir,
pi_email=pi_email,
add_user=list(set(add_user)),
project_description=project_description,
ignore_orderportal_members=ignore_orderportal_members,
)


# Release data
### Release data ###
@delivery.command()
@click.option(
"-d",
Expand Down
37 changes: 32 additions & 5 deletions taca/delivery/deliver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import sys

from taca.delivery.delivery_classes import get_staging_object
from taca.delivery.delivery_classes import get_staging_object, get_upload_object
from taca.utils.config import CONFIG

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -42,11 +42,38 @@ def stage(project, flowcells, samples):
# future todo: update statusdb with status "staged" (project, FC or sample level? Maybe new delivery DB?)


def upload_to_dds(project, dds_id):
"Upload staged data to DDS"
pass
def upload_to_dds(
project,
stage_dir,
pi_email=None,
add_user=None,
project_description=None,
ignore_orderportal_members=False,
):
"""Upload staged data to DDS"""
upload_object = get_upload_object(
project,
stage_dir,
pi_email,
add_user,
project_description,
ignore_orderportal_members,
)
dds_project_id = upload_object.create_dds_project()
delivery_status = upload_object.upload_data(dds_project_id)
if delivery_status:
logger.info(
f"Successfully uploaded {stage_dir} to DDS project {dds_project_id}"
)
# Future todo: Update statusdb with status "uploaded" and DDS project ID
else:
logger.error(
f"Something went wrong when uploading data to {dds_project_id} for project {project}."
)


def release_dds_project(project, dds_id):
"Release DDS project to user"
"""Release DDS project to user"""
# Release DDS project
# Update statusdb with status "delivered"
pass
Loading

0 comments on commit dc8948e

Please sign in to comment.