Skip to content

Commit

Permalink
test: completing tests for small variants (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Jan 29, 2023
1 parent fe9ccc2 commit 6f26d6b
Show file tree
Hide file tree
Showing 6 changed files with 430 additions and 17 deletions.
6 changes: 3 additions & 3 deletions clinvar_this/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def retrieve(config: config.Config, name: str, *, use_testing: bool = False):
submission_path = get_share_dir() / config.profile / name
submission_response_paths = list(sorted(submission_path.glob("submission-response.*.json")))

if not submission_path.exists():
if not submission_path.exists(): # pragma: no cover
raise exceptions.ClinvarThisException(f"Submission does not exist at {submission_path}")
elif not submission_response_paths:
elif not submission_response_paths: # pragma: no cover
raise exceptions.ClinvarThisException(
f"Submission not submitted? No submission response at {submission_path}"
)
Expand Down Expand Up @@ -311,6 +311,6 @@ def retrieve(config: config.Config, name: str, *, use_testing: bool = False):
logger.info("Will now update local information from response...")
_retrieve_store_response(config, name, status_result)
logger.info("... done updating local information from response")
else:
else: # pragma: no cover
logger.error("Status is %s and clinvar-this does not know how to handle this yet!")
raise exceptions.ClinvarThisException(f"Unknown status {status_str}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{
"status": {
"actions": [
{
"id": "SUB000fake-1",
"responses": [
{
"status": "error",
"files": [
{
"url": "https://submit.ncbi.nlm.nih.gov/api/2.0/files/fake/subfake-summary-report.json/?format=attachment"
}
],
"message": {
"error_code": "1",
"severity": "error",
"text": "Your ClinVar submission processing status is \"Partial success\". Please find the details in the file referenced by actions[0].responses[0].files[0].url."
},
"objects": []
}
],
"status": "error",
"target_db": "clinvar",
"updated": "2022-12-02T10:18:04+01:00"
}
]
},
"summaries": {
"https://submit.ncbi.nlm.nih.gov/api/2.0/files/fake/subfake-summary-report.json/?format=attachment": {
"batch_processing_status": "Partial success",
"batch_release_status": "Not released",
"submission_date": "2022-12-02",
"submission_name": "SUB000fake",
"total_count": 2,
"total_errors": 1,
"total_public": 0,
"total_success": 1,
"deletions": null,
"submissions": [
{
"identifiers": {
"clinvar_local_key": "fake",
"clinvar_accession": null,
"local_id": "fake",
"local_key": null
},
"processing_status": "Error",
"clinvar_accession_version": null,
"errors": [
{
"input": [
{
"value": "Variation",
"field": "Variant.type"
},
{
"value": null,
"field": "HGVS.accession"
},
{
"value": null,
"field": "HGVS.change"
},
{
"value": null,
"field": "HGVS.hgvs"
},
{
"value": "GRCh37",
"field": "SequenceLocation.assembly"
},
{
"value": "11",
"field": "SequenceLocation.chr"
},
{
"value": "123",
"field": "SequenceLocation.start"
},
{
"value": "1223",
"field": "SequenceLocation.stop"
},
{
"value": "T",
"field": "SequenceLocation.reference_allele"
},
{
"value": "A",
"field": "SequenceLocation.alternate_allele"
},
{
"value": null,
"field": "SequenceLocation.outer_start"
},
{
"value": null,
"field": "SequenceLocation.inner_start"
},
{
"value": null,
"field": "SequenceLocation.inner_stop"
},
{
"value": null,
"field": "SequenceLocation.outer_stop"
},
{
"value": null,
"field": "SequenceLocation.variant_length"
},
{
"value": null,
"field": "SequenceLocation.copy_number"
},
{
"value": null,
"field": "SequenceLocation.reference_copy_number"
},
{
"value": null,
"field": "SequenceLocation.breakpoint1"
},
{
"value": null,
"field": "SequenceLocation.breakpoint2"
},
{
"value": null,
"field": "Condition.name"
},
{
"value": "OMIM",
"field": "ConditionID.type"
},
{
"value": "12345",
"field": "ConditionID.value"
}
],
"output": {
"errors": [
{
"user_message": "This record is submitted as novel but it should be submitted as an update, including the SCV accession, because your organization previously submitted SCVfake for the same variant and condition."
}
]
}
}
],
"release_date": null,
"release_status": null
},
{
"identifiers": {
"clinvar_local_key": "fake",
"clinvar_accession": "SCVfake",
"local_id": "fake",
"local_key": "fake"
},
"processing_status": "Success",
"clinvar_accession_version": null,
"errors": null,
"release_date": null,
"release_status": null
}
],
"total_delete_count": null,
"total_deleted": null,
"total_delete_errors": null,
"total_delete_success": null
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"status": {
"actions": [
{
"id": "SUB000fake-1",
"responses": [
{
"status": "processing",
"files": [],
"message": {
"error_code": null,
"severity": "info",
"text": "Your ClinVar submission processing status is \"In processing\"."
},
"objects": []
}
],
"status": "processing",
"target_db": "clinvar",
"updated": "2022-11-18T16:25:05+01:00"
}
]
},
"summaries": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"status": {
"actions": [
{
"id": "SUB000fake-1",
"responses": [],
"status": "submitted",
"target_db": "clinvar",
"updated": "2022-11-18T16:24:19+01:00"
}
]
},
"summaries": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"status": {
"actions": [
{
"id": "SUB000fake-1",
"responses": [
{
"status": "processed",
"files": [
{
"url": "https://submit.ncbi.nlm.nih.gov/api/2.0/files/fake/fake/?format=attachment"
}
],
"message": {
"error_code": "0",
"severity": "info",
"text": "Your ClinVar submission processing status is \"Success\". Please find the details in the file referenced by actions[0].responses[0].files[0].url."
},
"objects": []
}
],
"status": "processed",
"target_db": "clinvar",
"updated": "2022-11-18T12:52:11+01:00"
}
]
},
"summaries": {
"https://submit.ncbi.nlm.nih.gov/api/2.0/files/fake/fake/?format=attachment": {
"batch_processing_status": "Success",
"batch_release_status": "Not released",
"submission_date": "2022-11-18",
"submission_name": "SUB000fake",
"total_count": 8,
"total_errors": 0,
"total_public": 0,
"total_success": 8,
"deletions": null,
"submissions": [
{
"identifiers": {
"clinvar_local_key": "clinvar-local-key",
"clinvar_accession": "SCVfake",
"local_id": "mock-uuid4-local-id",
"local_key": "mock-uuid4-local-key"
},
"processing_status": "Success",
"clinvar_accession_version": null,
"errors": null,
"release_date": null,
"release_status": null
}
],
"total_delete_count": null,
"total_deleted": null,
"total_delete_errors": null,
"total_delete_success": null
}
}
}
Loading

0 comments on commit 6f26d6b

Please sign in to comment.