def fixture_upload_genotypes_hk_api( real_housekeeper_api: HousekeeperAPI, upload_genotypes_hk_bundle: dict, analysis_obj: models.Analysis, helpers, ) -> HousekeeperAPI: """Add and include files from upload genotypes hk bundle""" helpers.ensure_hk_bundle(real_housekeeper_api, upload_genotypes_hk_bundle) hk_version = real_housekeeper_api.last_version( analysis_obj.family.internal_id) real_housekeeper_api.include(hk_version) return real_housekeeper_api
def fixture_mip_dna_housekeeper( real_housekeeper_api: HousekeeperAPI, mip_delivery_bundle: dict, fastq_delivery_bundle: dict, helpers: StoreHelpers, ) -> HousekeeperAPI: helpers.ensure_hk_bundle(real_housekeeper_api, bundle_data=mip_delivery_bundle) helpers.ensure_hk_bundle(real_housekeeper_api, bundle_data=fastq_delivery_bundle) # assert that the files exists version_obj_mip: hk_models.Version = real_housekeeper_api.last_version( mip_delivery_bundle["name"]) version_obj_fastq: hk_models.Version = real_housekeeper_api.last_version( fastq_delivery_bundle["name"]) real_housekeeper_api.include(version_obj=version_obj_mip) real_housekeeper_api.include(version_obj=version_obj_fastq) return real_housekeeper_api
def ensure_hk_bundle( store: HousekeeperAPI, bundle_data: dict, include: bool = False ) -> hk_models.Bundle: """Utility function to add a bundle of information to a housekeeper api""" bundle_exists = False for bundle in store.bundles(): if bundle.name != bundle_data["name"]: continue bundle_exists = True _bundle = bundle break if not bundle_exists: _bundle, _version = store.add_bundle(bundle_data) store.add_commit(_bundle, _version) if include: store.include(_version) return _bundle