Skip to content

umccr/wrapica

Repository files navigation

wrapica

Documentation Status Build and Deploy PyPI version

A suite of secondary / tertiary functions for running ICAv2 API calls.

Please visit our ReadTheDocs site for more information on installing and using wrapica.

Installing wrapica

pip install wrapica

Using wrapica

Project Data

# Standard imports
from pathlib import Path

# Wrapica imports
from wrapica.project import get_project_id_from_project_code
from wrapica.enums import DataType
from wrapica.libica_models import ProjectData
from wrapica.project_data import (
    # Functions
    get_project_data_obj_from_project_id_and_path,
    # Types
    ProjectData, DataType
)

# Get project data object
my_project_folder_obj: ProjectData = get_project_data_obj_from_project_id_and_path(
    project_id=get_project_id_from_project_code("my_project_name"),
    # Required value
    data_path=Path("/path/to/my/project/folder"),  
    # Optional FILE or FOLDER if not specified searches for both
    data_type=DataType.FOLDER,  
    # Optional, default is True (cannot be created if data_type is not specified)
    create_data_if_not_found=False,
)

Project Pipeline

from wrapica.configuration import get_configuration
from wrapica.project_pipeline import get_project_pipeline_id_from_pipeline_code


my_pipeline_id = get_project_pipeline_id_from_pipeline_code(
    project_id,
    pipeline_code
)

Project Analysis

from typing import List

from wrapica.project_analyses import get_workflow_steps
from wrapica.libica_models import AnalysisStep

workflow_steps: List[AnalysisStep] = get_workflow_steps(
    # Required values
    project_id="my_project_id",
    analysis_id="my_analysis_id",
)

for workflow_step in workflow_steps:
    print(workflow_step.name)
    print(workflow_step.status)