From db26cab443ad17085c9aff62f6ebcfdcf4601e28 Mon Sep 17 00:00:00 2001 From: Alex Stuckey Date: Mon, 4 Nov 2024 13:30:03 +1300 Subject: [PATCH] register missing combiner analysis script --- scripts/register_migging_combiner_analysis.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/register_migging_combiner_analysis.py diff --git a/scripts/register_migging_combiner_analysis.py b/scripts/register_migging_combiner_analysis.py new file mode 100644 index 000000000..687fc3939 --- /dev/null +++ b/scripts/register_migging_combiner_analysis.py @@ -0,0 +1,31 @@ +from argparse import ArgumentParser + +from hail.vds import read_vds + +from cpg_utils import to_path +from metamist.apis import AnalysisApi +from metamist.models import Analysis, AnalysisStatus + + +def get_sg_ids(vds: str) -> list[str]: + return read_vds(to_path(vds)).variant_data.s.collect() + + +def main(vds: str, dataset: str): + aapi = AnalysisApi() + am = Analysis( + type='combiner', + output=vds, + status=AnalysisStatus('completed'), + sequencing_group_ids=get_sg_ids(vds), + meta=None, + ) + aapi.create_analysis(project=dataset, analysis=am) + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--vds', help='VDS to register analysis for.') + parser.add_argument('--dataset', help='Dataset to register analysis in.') + args = parser.parse_args() + main(args.vds, args.dataset)