Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding features based on genomicSourClass #50

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions app/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,9 @@ def find_subject_haplotypes(
query["specimenID"] = {"$in": specimenIdentifiers}

# Genomic Source Class Query
# if genomicSourceClass:
# genomicSourceClass = genomicSourceClass.strip().lower()
# query["genomicSourceClass"] = {"$eq": genomicSourceClass}
if genomicSourceClass:
genomicSourceClass = genomicSourceClass.strip().lower()
query["genomicSourceClass"] = {"$eq": genomicSourceClass}

# Result Object
result = OrderedDict()
Expand Down Expand Up @@ -655,6 +655,13 @@ def find_subject_haplotypes(

result["parameter"].append(parameter)

# Add genomic source class option to result object
if genomicSourceClass:
parameter = OrderedDict()
parameter["name"] = "genomicSourceClass"
parameter["part"] = [{"name": genomicSourceClass.capitalize(), "valueString": genomicSourceClass}]
result["parameter"].append(parameter)

if not result["parameter"]:
result.pop("parameter")

Expand Down
23 changes: 23 additions & 0 deletions tests/expected_outputs/find_subject_haplotypes/5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"resourceType": "Parameters",
"parameter": [
{
"name": "haplotypes",
"part": [
{
"name": "geneItem",
"valueString": "HGNC:2625"
}
]
},
{
"name": "genomicSourceClass",
"part": [
{
"name": "Germline",
"valueString": "germline"
}
]
}
]
}
23 changes: 23 additions & 0 deletions tests/expected_outputs/find_subject_haplotypes/6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"resourceType": "Parameters",
"parameter": [
{
"name": "haplotypes",
"part": [
{
"name": "geneItem",
"valueString": "HGNC:2625"
}
]
},
{
"name": "genomicSourceClass",
"part": [
{
"name": "Somatic",
"valueString": "somatic"
}
]
}
]
}
14 changes: 14 additions & 0 deletions tests/integration_tests/test_subject_genotype_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@ def test_find_subject_haplotypes_4(client):
tu.compare_actual_and_expected_output(f'{tu.FIND_SUBJECT_HAPLOTYPES_OUTPUT_DIR}4.json', response.json)


def test_find_subject_haplotypes_5(client):
url = tu.find_subject_haplotypes_query('subject=NB6TK328&genes=http://www.genenames.org/geneId|HGNC:2625&genomicSourceClass=germline')
response = client.get(url)

tu.compare_actual_and_expected_output(f'{tu.FIND_SUBJECT_HAPLOTYPES_OUTPUT_DIR}5.json', response.json)


def test_find_subject_haplotypes_6(client):
url = tu.find_subject_haplotypes_query('subject=NB6TK328&genes=http://www.genenames.org/geneId|HGNC:2625&genomicSourceClass=somatic')
response = client.get(url)

tu.compare_actual_and_expected_output(f'{tu.FIND_SUBJECT_HAPLOTYPES_OUTPUT_DIR}6.json', response.json)


"""
Find Subject Specific Haplotypes Tests
--------------------------------------
Expand Down