diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c9fef60ea..67324cae1 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 7.5.0 +current_version = 7.5.1 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P[A-z0-9-]+) diff --git a/api/server.py b/api/server.py index 1443b5b24..069663472 100644 --- a/api/server.py +++ b/api/server.py @@ -25,7 +25,7 @@ from db.python.utils import get_logger # This tag is automatically updated by bump2version -_VERSION = '7.5.0' +_VERSION = '7.5.1' logger = get_logger() diff --git a/db/python/layers/project_insights.py b/db/python/layers/project_insights.py index 6c649c497..9fe602e01 100644 --- a/db/python/layers/project_insights.py +++ b/db/python/layers/project_insights.py @@ -750,7 +750,7 @@ async def _sequencing_group_details_by_project_and_seq_fields( sg.technology as sequencing_technology, s.type as sample_type, f.id as family_id, - f.external_id as family_external_id, + fext.external_id as family_external_id, fp.participant_id as participant_id, pext.external_id as participant_external_id, s.id as sample_id, @@ -759,6 +759,7 @@ async def _sequencing_group_details_by_project_and_seq_fields( FROM family f LEFT JOIN family_participant fp ON f.id = fp.family_id + LEFT JOIN family_external_id fext ON f.id = fext.family_id LEFT JOIN participant_external_id pext ON fp.participant_id = pext.participant_id LEFT JOIN sample s ON fp.participant_id = s.participant_id LEFT JOIN sample_external_id sext ON s.id = sext.sample_id diff --git a/deploy/python/version.txt b/deploy/python/version.txt index 18bb4182d..a5f017a0a 100644 --- a/deploy/python/version.txt +++ b/deploy/python/version.txt @@ -1 +1 @@ -7.5.0 +7.5.1 diff --git a/scripts/register_missing_combiner_analysis.py b/scripts/register_missing_combiner_analysis.py new file mode 100644 index 000000000..4a686e13e --- /dev/null +++ b/scripts/register_missing_combiner_analysis.py @@ -0,0 +1,55 @@ +"""Register a missing combiner analysis in Metamist + +Ad-hoc script to register a missing combiner analysis in Metamist. +Is supremely inflexible since there is a short timeframe for combining previous +VDS' for the OurDNA browser release. +""" + +from argparse import ArgumentParser + +from hail.vds import read_vds + +from cpg_utils.hail_batch import config_retrieve, init_batch +from metamist.apis import AnalysisApi +from metamist.models import Analysis, AnalysisStatus + + +def get_sg_ids(vds: str) -> list[str]: + """Gets all sequencing group IDs from a VDS + + Args: + vds (str): The VDS to extract the sequencing group IDs from + + Returns: + list[str]: A list of sequencing group IDs. + """ + return read_vds(vds).variant_data.s.collect() + + +def main(vds: str): + """Create and register a missing combiner analysis + + Args: + vds (str): The existing VDS that needs to be registered + dataset (str): The project / dataset to register the analysis in + """ + init_batch() + aapi = AnalysisApi() + am = Analysis( + type='combiner', + output=vds, + status=AnalysisStatus('completed'), + sequencing_group_ids=get_sg_ids(vds), + meta={}, + ) + dataset: str = config_retrieve(['workflow', 'dataset']) + if config_retrieve(['workflow', 'access_level']) == 'test': + dataset += '-test' + aapi.create_analysis(project=dataset, analysis=am) + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--vds', help='VDS to register analysis for.') + args = parser.parse_args() + main(args.vds) diff --git a/setup.py b/setup.py index 481a0ddce..8db6e0463 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name=PKG, # This tag is automatically updated by bump2version - version='7.5.0', + version='7.5.1', description='Python API for interacting with the Sample API system', long_description=readme, long_description_content_type='text/markdown', diff --git a/test/test_project_insights.py b/test/test_project_insights.py index 2db282e8f..efa1c42c4 100644 --- a/test/test_project_insights.py +++ b/test/test_project_insights.py @@ -111,3 +111,14 @@ async def test_project_insights_summary(self): ] self.assertEqual(result, expected) + + @run_as_sync + async def test_project_insights_details(self): + """Test getting the details for all available projects""" + + await self.partl.upsert_participant(get_test_participant()) + + # There's not enough data set up to usefully verify the result + _ = await self.pil.get_project_insights_details( + project_names=[self.project_name], sequencing_types=['genome', 'exome'] + ) diff --git a/test/test_sequencing_groups.py b/test/test_sequencing_groups.py index 575a1b454..301072d63 100644 --- a/test/test_sequencing_groups.py +++ b/test/test_sequencing_groups.py @@ -127,10 +127,9 @@ async def test_auto_deprecation_of_old_sequencing_group(self): type='sequencing', external_ids={'second-key': 'second-sequencing-object'}, meta={ - 'second-sequencing-object' 'sequencing_type': 'genome', + 'sequencing_type': 'genome', 'sequencing_platform': 'short-read', 'sequencing_technology': 'illumina', - 'sequencing_type': 'genome', }, ), ], diff --git a/web/package.json b/web/package.json index eed2edd2d..a1353133a 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "metamist", - "version": "7.5.0", + "version": "7.5.1", "private": true, "dependencies": { "@apollo/client": "^3.11.5",