Skip to content

Commit

Permalink
Linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EddieLF committed Sep 19, 2024
1 parent d9b732e commit e5661d6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
32 changes: 18 additions & 14 deletions db/python/layers/project_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,15 @@ def get_sg_web_report_links(
}

return report_links

def get_cram_record(
self, cram_row: AnalysisRow | None
):

def get_cram_record(self, cram_row: AnalysisRow | None):
"""Get the CRAM record for a sequencing group"""
return {
'id': cram_row.id if cram_row else None,
'output': cram_row.output if cram_row else None,
'timestamp_completed': cram_row.timestamp_completed.strftime('%d-%m-%y') if cram_row else None,
'timestamp_completed': cram_row.timestamp_completed.strftime('%d-%m-%y')
if cram_row
else None,
}

def get_analysis_stats_internal_from_record(
Expand Down Expand Up @@ -569,10 +570,12 @@ async def _crams_by_project_id_and_seq_fields(
return self.parse_project_seqtype_technology_keyed_rows(
_query_results, 'sequencing_group_ids'
)

async def _sg_crams_by_project_id_and_seq_fields(
self, project_ids: list[ProjectId], sequencing_types: list[str]
) -> dict[ProjectSeqTypeTechnologyKey, dict[SequencingGroupInternalId, AnalysisRow]]:
) -> dict[
ProjectSeqTypeTechnologyKey, dict[SequencingGroupInternalId, AnalysisRow]
]:
_query = """
SELECT
a.project,
Expand Down Expand Up @@ -613,9 +616,9 @@ async def _sg_crams_by_project_id_and_seq_fields(
'sequencing_types': sequencing_types,
},
)

cram_timestamps_by_project_id_and_seq_fields: dict[
ProjectSeqTypeKey, dict[SequencingGroupInternalId, AnalysisRow]
ProjectSeqTypeTechnologyKey, dict[SequencingGroupInternalId, AnalysisRow]
] = {}
for row in _query_results:
key = ProjectSeqTypeTechnologyKey(
Expand All @@ -634,7 +637,6 @@ async def _sg_crams_by_project_id_and_seq_fields(
cram_timestamps_by_project_id_and_seq_fields[key][sg_id] = cram_row
return cram_timestamps_by_project_id_and_seq_fields


async def _latest_annotate_dataset_by_project_id_and_seq_type(
self, project_ids: list[ProjectId], sequencing_types: list[str]
) -> dict[ProjectSeqTypeKey, AnalysisRow]:
Expand All @@ -661,7 +663,7 @@ async def _latest_annotate_dataset_by_project_id_and_seq_type(
) max_timestamps ON a.project = max_timestamps.project
AND a.timestamp_completed = max_timestamps.max_timestamp
AND JSON_UNQUOTE(JSON_EXTRACT(a.meta, '$.sequencing_type')) = max_timestamps.sequencing_type
WHERE
WHERE
a.type = 'CUSTOM'
AND a.status = 'COMPLETED'
AND a.project IN :projects
Expand Down Expand Up @@ -711,7 +713,7 @@ async def _latest_es_indices_by_project_id_and_seq_type_and_stage(
AND a.timestamp_completed = max_timestamps.max_timestamp
AND JSON_UNQUOTE(JSON_EXTRACT(a.meta, '$.sequencing_type')) = max_timestamps.sequencing_type
AND JSON_EXTRACT(a.meta, '$.stage') = max_timestamps.stage
WHERE
WHERE
a.project IN :projects
AND JSON_UNQUOTE(JSON_EXTRACT(a.meta, '$.sequencing_type')) in :sequencing_types;
"""
Expand Down Expand Up @@ -1104,8 +1106,10 @@ async def get_project_insights_details(
):
continue

sequencing_groups_crams: dict[SequencingGroupInternalId, AnalysisRow] = crams_by_project_id_and_seq_fields.get(
(project.id, seq_type, seq_tech), {}
sequencing_groups_crams: dict[SequencingGroupInternalId, AnalysisRow] = (
crams_by_project_id_and_seq_fields.get(
(project.id, seq_type, seq_tech), {}
)
)
(
latest_annotate_dataset_row,
Expand Down
14 changes: 10 additions & 4 deletions test/data/generate_seqr_project_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,17 +626,23 @@ async def main():
body={'meta': {'is_seqr': 'true'}},
)
logging.info(f'Set {project} as seqr project')

project_id_query_result = await query_async(QUERY_PROJECT_ID, {'project': project})

project_id_query_result = await query_async(
QUERY_PROJECT_ID, {'project': project}
)
project_id = project_id_query_result['project']['id']

participant_id_map = await generate_project_pedigree(project)

await generate_sample_entries(project, participant_id_map, metamist_enums, sapi)

aligned_sgs = await generate_cram_analyses(project, project_id, analyses_to_insert)
aligned_sgs = await generate_cram_analyses(
project, project_id, analyses_to_insert
)

await generate_web_report_analyses(project, project_id, aligned_sgs, analyses_to_insert)
await generate_web_report_analyses(
project, project_id, aligned_sgs, analyses_to_insert
)

await generate_joint_called_analyses(project, aligned_sgs, analyses_to_insert)

Expand Down
2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"private": true,
"dependencies": {
"@apollo/client": "^3.7.3",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@monaco-editor/react": "^4.6.0",
"@mui/icons-material": "^5.10.9",
"@mui/material": "^5.10.9",
Expand Down

0 comments on commit e5661d6

Please sign in to comment.