Skip to content

Commit

Permalink
Merge d70c47e into 8f31e6b
Browse files Browse the repository at this point in the history
  • Loading branch information
mayabrandi committed Apr 6, 2021
2 parents 8f31e6b + d70c47e commit 1ccbf4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions NIPTool/API/external/utils.py
Expand Up @@ -250,17 +250,16 @@ def get_tris_control_normal(adapter, chr):
{"$match": {f"status_{chr}": {"$eq": "Normal"}, "include": {"$eq": True}}},
{
"$group": {
"_id": {f"status_T{chr}": f"$status_T{chr}"},
"_id": {f"status_{chr}": f"$status_{chr}"},
"values": {"$push": f"$Zscore_{chr}"},
"names": {"$push": "$sample_id"},
"count": {"$sum": 1},
}
},
]
if not list(find.sample_aggregate(pipe=pipe, adapter=adapter)):
return []
data = list(find.sample_aggregate(pipe=pipe, adapter=adapter))[0]

return {}
data = find.sample_aggregate(pipe=pipe, adapter=adapter)[0]
data["values"] = [value for value in data.get("values", [])]

return data
Expand Down Expand Up @@ -355,6 +354,7 @@ def get_normal_for_samp_tris_plot(adapter):
data_per_abnormaliy = {}
x_axis = 1
for abn in ["13", "18", "21"]:

data = get_tris_control_normal(adapter, abn)
data["x_axis"] = [x_axis] * data.get("count", 0)
data_per_abnormaliy[abn] = data
Expand Down
4 changes: 2 additions & 2 deletions NIPTool/crud/find.py
Expand Up @@ -45,13 +45,13 @@ def batches(adapter: NiptAdapter) -> List[Batch]:
def sample_aggregate(adapter: NiptAdapter, pipe: list) -> list:
"""Aggregates a query pipeline on the sample collection"""

return adapter.sample_collection.aggregate(pipe)
return list(adapter.sample_collection.aggregate(pipe))


def batch_aggregate(adapter: NiptAdapter, pipe: list) -> List[Batch]:
"""Aggregates a query pipeline on the sample collection"""

return adapter.batch_collection.aggregate(pipe)
return list(adapter.batch_collection.aggregate(pipe))


def batch_samples(adapter: NiptAdapter, batch_id: str) -> List[Sample]:
Expand Down

0 comments on commit 1ccbf4c

Please sign in to comment.