Skip to content

Commit

Permalink
Merge pull request #987 from populationgenomics/dev
Browse files Browse the repository at this point in the history
Release: project_insights multiple family extids fix and register_missing_combiner_analysis.py script
  • Loading branch information
jmarshall authored Nov 5, 2024
2 parents f3364b5 + ca01532 commit 1d7dc0e
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 7.5.0
current_version = 7.5.1
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>[A-z0-9-]+)
Expand Down
2 changes: 1 addition & 1 deletion api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion db/python/layers/project_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deploy/python/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.5.1
55 changes: 55 additions & 0 deletions scripts/register_missing_combiner_analysis.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 11 additions & 0 deletions test/test_project_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
)
3 changes: 1 addition & 2 deletions test/test_sequencing_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamist",
"version": "7.5.0",
"version": "7.5.1",
"private": true,
"dependencies": {
"@apollo/client": "^3.11.5",
Expand Down

0 comments on commit 1d7dc0e

Please sign in to comment.