Skip to content

Commit

Permalink
Soecify that current file conversion endpoints work only for germline…
Browse files Browse the repository at this point in the history
… submissions
  • Loading branch information
Chiara Rasi committed Jan 29, 2025
1 parent 338ce83 commit 13d97cd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [unreleased]
### Changed
- Improve README and endpoint descriptions specifying that `tsv_2_json` and `csv_2_json` endpoints support only coversion for germline submission files

## [2.7.1]
### Fixed
- Replace the CMD step of the Dockerfile with an ENTRYPOINT that uses `/bin/sh -c` to evaluates the shell commands and expand environment variables.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ A running instance of the service is available at https://preclinvar.scilifelab.

### tsv_2_json

Transforms tsv submission files (Variant.tsv and CaseData.tsv) into a json submission object, ready to be used to submit via the ClinVar API. This document is validated against the ClinVar API [submission schema](https://www.ncbi.nlm.nih.gov/clinvar/docs/api_http/)
Transforms tsv submission files **from a germline submission** (Variant.tsv and CaseData.tsv) into a json submission object, ready to be used to submit via the ClinVar API. This document is validated against the ClinVar API [submission schema](https://www.ncbi.nlm.nih.gov/clinvar/docs/api_http/)

### csv_2_json

Transforms csv submission files (Variant.csv and CaseData.csv) into a json submission object, ready to be used to submit via the ClinVar API. This document is validated against the ClinVar API [submission schema](https://www.ncbi.nlm.nih.gov/clinvar/docs/api_http/)
Transforms csv submission files **from a germline submission** (Variant.csv and CaseData.csv) into a json submission object, ready to be used to submit via the ClinVar API. This document is validated against the ClinVar API [submission schema](https://www.ncbi.nlm.nih.gov/clinvar/docs/api_http/)

### dry_run

Expand Down
28 changes: 20 additions & 8 deletions preClinVar/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

from preClinVar.__version__ import VERSION
from preClinVar.build import build_header, build_submission
from preClinVar.constants import DRY_RUN_SUBMISSION_URL, SUBMISSION_URL, VALIDATE_SUBMISSION_URL
from preClinVar.constants import (
DRY_RUN_SUBMISSION_URL,
SUBMISSION_URL,
VALIDATE_SUBMISSION_URL,
)
from preClinVar.file_parser import csv_lines, file_fields_to_submission, tsv_lines
from preClinVar.validate import validate_submission

Expand All @@ -37,7 +41,9 @@ async def root():


@app.post("/apitest-status")
async def apitest_status(api_key: str = Form(), submission_id: str = Form()) -> JSONResponse:
async def apitest_status(
api_key: str = Form(), submission_id: str = Form()
) -> JSONResponse:
"""Returns the status (validation) of a test submission to the apitest endpoint."""

# Create a submission header
Expand Down Expand Up @@ -116,7 +122,7 @@ async def tsv_2_json(
request: Request,
files: List[UploadFile] = File(...),
):
"""Create a json submission object using 2 TSV files (Variant.tsv and CaseData.tsv).
"""Create a json submission object using 2 TSV files from a germline submission (Variant.tsv and CaseData.tsv).
Validate the submission objects against the official schema:
https://www.ncbi.nlm.nih.gov/clinvar/docs/api_http/
"""
Expand Down Expand Up @@ -159,7 +165,9 @@ async def tsv_2_json(
)
return JSONResponse(
status_code=400,
content={"message": f"Created json file contains validation errors: {valid_results[1]}"},
content={
"message": f"Created json file contains validation errors: {valid_results[1]}"
},
)


Expand All @@ -168,8 +176,8 @@ async def csv_2_json(
request: Request,
files: List[UploadFile] = File(...),
):
"""Create a json submission object using 2 CSV files (Variant.csv and CaseData.csv).
Validate the submission objects agains the official schema:
"""Create a json submission object using 2 CSV files from a germline submission (Variant.csv and CaseData.csv).
Validate the submission objects against the official schema:
https://www.ncbi.nlm.nih.gov/clinvar/docs/api_http/
"""

Expand Down Expand Up @@ -218,7 +226,9 @@ async def csv_2_json(
)
return JSONResponse(
status_code=400,
content={"message": f"Created json file contains validation errors: {valid_results[1]}"},
content={
"message": f"Created json file contains validation errors: {valid_results[1]}"
},
)


Expand All @@ -245,7 +255,9 @@ async def delete(api_key: str = Form(), clinvar_accession: str = Form()):
header = build_header(api_key)

# Create a submission deletion object
delete_obj = {"clinvarDeletion": {"accessionSet": [{"accession": clinvar_accession}]}}
delete_obj = {
"clinvarDeletion": {"accessionSet": [{"accession": clinvar_accession}]}
}

data = {
"actions": [
Expand Down

0 comments on commit 13d97cd

Please sign in to comment.