Skip to content

Commit

Permalink
feat: conversion from DRAGEN QC to legacy varfish format (#85) (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Jan 23, 2024
1 parent 2e7c4f1 commit 043dbc3
Show file tree
Hide file tree
Showing 34 changed files with 1,095 additions and 277 deletions.
55 changes: 34 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
.PHONY: all
all: black
.PHONY: default
default: help

.PHONY: help
help:
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@echo " format Format code with isort and black"
@echo " lint Lint code with flake8, isort and black"
@echo " format-black Format code with black"
@echo " lint-black Lint code with black"
@echo " format-isort Format code with isort"
@echo " lint-isort Lint code with isort"
@echo " lint-flake8 Lint code with flake8"
@echo " test Run tests"
@echo " test-update-snapshots"
@echo " Run tests and update snapshots"

.PHONY: format
format: format-isort format-black

.PHONY: black
black:
.PHONY: lint
lint: lint-flake8 lint-isort lint-black

.PHONY: format-black
format-black:
black -l 100 .

.PHONY: black-check
black-check:
.PHONY: lint-black
lint-black:
black -l 100 --check .

.PHONY: isort
isort:
.PHONY: format-isort
format-isort:
isort --force-sort-within-sections --profile=black .

.PHONY: isort-check
isort-check:
.PHONY: lint-isort
lint-isort:
isort --force-sort-within-sections --profile=black --check .

.PHONY: flake8
flake8:
.PHONY: lint-flake8
lint-flake8:
flake8

# .PHONY: mypy
# mypy: export MYPYPATH=stubs
# mypy:
# mypy clinvar_this clinvar_api tests

.PHONY: lint
lint: flake8 isort-check black-check
# lint: flake8 isort-check black-check mypy

.PHONY: test
test:
TZ=UTC LC_ALL=C pytest .
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pytest-runner >=2.11.1
pytest-cache >=1.0
pytest-cov >=2.4.0
pytest-mock >=2.0.0
pytest-snapshot >=0.9,<0.10
syrupy >=4.6.0,<5.0.0

# Faking of file systems
pyfakefs >=3.7.1
Expand Down
56 changes: 56 additions & 0 deletions tests/cli/__snapshots__/test_cases.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# serializer version: 1
# name: test_case_list_one_element
'''
+--------------------------------------+--------------+---------------------------+-------------------------------------------------------------------------------------------+
| sodar_uuid | name | index | members |
+======================================+==============+===========================+===========================================================================================+
| 0b96111f-00c9-4ed2-a4a2-ec2ec3322066 | Case_3_index | Case_3_index-N1-DNA1-WGS1 | ['Case_3_index-N1-DNA1-WGS1', 'Case_3_father-N1-DNA1-WGS1', 'Case_3_mother-N1-DNA1-WGS1'] |
+--------------------------------------+--------------+---------------------------+-------------------------------------------------------------------------------------------+

'''
# ---
# name: test_case_retrieve
'''
{
"release": "GRCh37",
"name": "Case_3_index",
"index": "Case_3_index-N1-DNA1-WGS1",
"pedigree": [
{
"name": "Case_3_index-N1-DNA1-WGS1",
"father": "Case_3_father-N1-DNA1-WGS1",
"mother": "Case_3_mother-N1-DNA1-WGS1",
"sex": 2,
"affected": 2,
"has_gt_entries": true
},
{
"name": "Case_3_father-N1-DNA1-WGS1",
"father": "0",
"mother": "0",
"sex": 1,
"affected": 1,
"has_gt_entries": true
},
{
"name": "Case_3_mother-N1-DNA1-WGS1",
"father": "0",
"mother": "0",
"sex": 2,
"affected": 1,
"has_gt_entries": true
}
],
"sodar_uuid": "0b96111f-00c9-4ed2-a4a2-ec2ec3322066",
"owner": null,
"date_created": "2023-06-26T17:15:13+02:00",
"date_modified": "2023-08-02T14:34:05+02:00",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"case": null,
"state": "draft",
"notes": "asdf",
"tags": []
}

'''
# ---
29 changes: 29 additions & 0 deletions tests/cli/__snapshots__/test_importer.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# serializer version: 1
# name: test_varannoset_list_one_element
'''
Case Import Info List
=====================

- uuid: '8adbf84e-adb2-4c5d-9b5a-2a8194307b79'
release: 'GRCh37'
owner: 'root'
name: 'NA12878'
index: 'NA12878-N1-DNA1-WES1'
members:
- { name: 'NA12878-N1-DNA1-WES1', father: 'NA12891-N1-DNA1-WES1', mother: 'NA12892-N1-DNA1-WES1', sex: 2, affected: 2 }
- { name: 'NA12891-N1-DNA1-WES1', father: '0', mother: '0', sex: 1, affected: 1 }
- { name: 'NA12892-N1-DNA1-WES1', father: '0', mother: '0', sex: 2, affected: 1 }

- uuid: '539fca3a-554f-4595-bfb3-b692f8ddef9e'
release: 'GRCh37'
owner: 'root'
name: 'Case_3_index'
index: 'Case_3_index-N1-DNA1-WGS1'
members:
- { name: 'Case_3_index-N1-DNA1-WGS1', father: 'Case_3_father-N1-DNA1-WGS1', mother: 'Case_3_mother-N1-DNA1-WGS1', sex: 1, affected: 2 }
- { name: 'Case_3_father-N1-DNA1-WGS1', father: '0', mother: '0', sex: 1, affected: 1 }
- { name: 'Case_3_mother-N1-DNA1-WGS1', father: '0', mother: '0', sex: 2, affected: 1 }


'''
# ---
43 changes: 43 additions & 0 deletions tests/cli/__snapshots__/test_projects.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# serializer version: 1
# name: test_project_list_two_elements
'''
[
{
"sodar_uuid": "4071c7f5769447f69dd9d2834d4b0164",
"parent": null,
"title": "Test Category",
"type": "CATEGORY",
"description": null,
"readme": "",
"public_guest_access": false,
"archive": false
},
{
"sodar_uuid": "25cd0ca405bd41dc930dbef805e92d0f",
"parent": "4071c7f5769447f69dd9d2834d4b0164",
"title": "Test Project",
"type": "PROJECT",
"description": null,
"readme": "",
"public_guest_access": false,
"archive": false
}
]

'''
# ---
# name: test_project_retrieve
'''
{
"sodar_uuid": "4071c7f5-7694-47f6-9dd9-d2834d4b0164",
"parent": null,
"title": "Test Category",
"type": "CATEGORY",
"description": null,
"readme": "",
"public_guest_access": false,
"archive": false
}

'''
# ---
10 changes: 10 additions & 0 deletions tests/cli/__snapshots__/test_tools.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# serializer version: 1
# name: test_dragen_to_bam_qc
'''
['sample', 'sample2'] {'sample': 'tests/cli/data/dragen_qc/sample.qc-coverage-region-1_coverage_metrics.csv', 'sample2': 'tests/cli/data/dragen_qc/sample2.qc-coverage-region-1_coverage_metrics.csv'} {'sample': 'tests/cli/data/dragen_qc/sample.mapping_metrics.csv', 'sample2': 'tests/cli/data/dragen_qc/sample2.mapping_metrics.csv'}

'''
# ---
# name: test_load_bam_qc
BamQc(sample_data={'sample': BamQcData(summary={'mean coverage': 35.44, 'total target size': 39036020}, min_cov_target={0: 100.0, 1: 99.0, 3: 98.77, 10: 98.18, 15: 97.59, 20: 95.41, 50: 0.88, 100: 0.05, 500: 0.03, 1000: 0.03, 1500: 0.03}, bamstats={'sequences': 1055691016, 'reads duplicated': 65335430, 'insert size average': 488.03, 'insert size standard deviation': 115.27}), 'sample2': BamQcData(summary={'mean coverage': 35.44, 'total target size': 39036020}, min_cov_target={0: 100.0, 1: 99.0, 3: 98.77, 10: 98.18, 15: 97.59, 20: 95.41, 50: 0.88, 100: 0.05, 500: 0.03, 1000: 0.03, 1500: 0.03}, bamstats={'sequences': 1055691016, 'reads duplicated': 65335430, 'insert size average': 488.03, 'insert size standard deviation': 115.27})})
# ---
162 changes: 162 additions & 0 deletions tests/cli/__snapshots__/test_varannos.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# serializer version: 1
# name: test_varannoset_create
'''
{'sodar_uuid': 'e211747f-2a50-4a65-b192-c96bc2e111fa', 'date_created': '2023-10-31T08:15:15+01:00', 'date_modified': '2023-10-31T08:15:15+01:00', 'project': '062b8838-453f-4cf3-817d-a5ec76546462', 'title': 'my title', 'description': 'None', 'release': 'GRCh37', 'fields': ['pathogenicity', 'notes']}
{
"sodar_uuid": "e211747f-2a50-4a65-b192-c96bc2e111fa",
"date_created": "2023-10-31T08:15:15+01:00",
"date_modified": "2023-10-31T08:15:15+01:00",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"title": "my title",
"description": "None",
"release": "GRCh37",
"fields": [
"pathogenicity",
"notes"
]
}

'''
# ---
# name: test_varannoset_list_one_element
'''
[
{
"sodar_uuid": "e211747f2a504a65b192c96bc2e111fa",
"date_created": "2023-10-31T08:15:15.000000+0100",
"date_modified": "2023-10-31T08:15:15.000000+0100",
"project": "062b8838453f4cf3817da5ec76546462",
"title": "my title",
"description": "None",
"release": "GRCh37",
"fields": [
"pathogenicity",
"notes"
]
}
]

'''
# ---
# name: test_varannoset_retrieve
'''
{
"sodar_uuid": "e211747f-2a50-4a65-b192-c96bc2e111fa",
"date_created": "2023-10-31T08:15:15+01:00",
"date_modified": "2023-10-31T08:15:15+01:00",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"title": "my title",
"description": "None",
"release": "GRCh37",
"fields": [
"pathogenicity",
"notes"
]
}

'''
# ---
# name: test_varannoset_update
'''
{
"sodar_uuid": "e211747f-2a50-4a65-b192-c96bc2e111fa",
"date_created": "2023-10-31T08:15:15+01:00",
"date_modified": "2023-10-31T08:15:15+01:00",
"project": "062b8838-453f-4cf3-817d-a5ec76546462",
"title": "my title",
"description": "None",
"release": "GRCh37",
"fields": [
"pathogenicity",
"notes"
]
}

'''
# ---
# name: test_varannosetentry_create
'''
{
"sodar_uuid": "4a3a96ae-ddd8-4e9f-897f-5fbbadfedad5",
"date_created": "2023-10-31T09:02:26+01:00",
"date_modified": "2023-10-31T09:02:26+01:00",
"varannoset": "0a30d59b-7257-43d1-8964-2a2ac50af7f2",
"release": "GRCh37",
"chromosome": "1",
"start": 100,
"end": 100,
"reference": "A",
"alternative": "T",
"payload": {
"pathogenic": "likely-pathogenic",
"notes": "TEST"
}
}

'''
# ---
# name: test_varannosetentry_list_one_element
'''
[
{
"sodar_uuid": "4a3a96aeddd84e9f897f5fbbadfedad5",
"date_created": "2023-10-31T09:02:26.000000+0100",
"date_modified": "2023-10-31T09:02:26.000000+0100",
"varannoset": "0a30d59b725743d189642a2ac50af7f2",
"release": "GRCh37",
"chromosome": "1",
"start": 100,
"end": 100,
"reference": "A",
"alternative": "T",
"payload": {
"pathogenic": "likely-pathogenic",
"notes": "TEST"
}
}
]

'''
# ---
# name: test_varannosetentry_retrieve
'''
{
"sodar_uuid": "4a3a96ae-ddd8-4e9f-897f-5fbbadfedad5",
"date_created": "2023-10-31T09:02:26+01:00",
"date_modified": "2023-10-31T09:02:26+01:00",
"varannoset": "0a30d59b-7257-43d1-8964-2a2ac50af7f2",
"release": "GRCh37",
"chromosome": "1",
"start": 100,
"end": 100,
"reference": "A",
"alternative": "T",
"payload": {
"pathogenic": "likely-pathogenic",
"notes": "TEST"
}
}

'''
# ---
# name: test_varannosetentry_update
'''
{
"sodar_uuid": "4a3a96ae-ddd8-4e9f-897f-5fbbadfedad5",
"date_created": "2023-10-31T09:02:26+01:00",
"date_modified": "2023-10-31T09:02:26+01:00",
"varannoset": "0a30d59b-7257-43d1-8964-2a2ac50af7f2",
"release": "GRCh37",
"chromosome": "1",
"start": 100,
"end": 100,
"reference": "A",
"alternative": "T",
"payload": {
"pathogenic": "likely-pathogenic",
"notes": "TEST"
}
}

'''
# ---
Loading

0 comments on commit 043dbc3

Please sign in to comment.