diff --git a/app/common.py b/app/common.py index f64261ba..f671b452 100644 --- a/app/common.py +++ b/app/common.py @@ -743,7 +743,6 @@ def create_molecular_consequence_profile(molecular_consequence, subject, vids): return resource - def create_tx_implication_profile_civic(implication, subject, vids): resource = OrderedDict() resource["resourceType"] = "Observation" @@ -1874,6 +1873,7 @@ def query_transcript(transcript): return results + def query_molecular_consequences_by_variants(normalized_variant_list, feature_consequence_list, query): variant_list = [] for item in normalized_variant_list: diff --git a/app/endpoints.py b/app/endpoints.py index 6318ddf5..98cee752 100644 --- a/app/endpoints.py +++ b/app/endpoints.py @@ -1159,6 +1159,7 @@ def find_subject_dx_implications( return jsonify(result) + def find_subject_molecular_consequences( subject, variants=None, ranges=None, featureConsequence=None, testIdentifiers=None, testDateRange=None, specimenIdentifiers=None, genomicSourceClass=None): diff --git a/utilities/mongo_utilities.py b/utilities/mongo_utilities.py deleted file mode 100644 index 96db7efa..00000000 --- a/utilities/mongo_utilities.py +++ /dev/null @@ -1,46 +0,0 @@ -import pymongo - -# can use this script to help debug mongo queries - -# MongoDB Client URIs -FHIR_genomics_data_client_uri = "mongodb+srv://download:download@cluster0.8ianr.mongodb.net/FHIRGenomicsData" -utilities_data_client_uri = "mongodb+srv://download:download@cluster0.8ianr.mongodb.net/UtilitiesData" - -# MongoDB Clients -client = pymongo.MongoClient(FHIR_genomics_data_client_uri) -utilities_client = pymongo.MongoClient(utilities_data_client_uri) - -# Databases -db = client.FHIRGenomicsData -utilities_db = utilities_client.UtilitiesData - - -# Collections -variants = db.Variants -molconseqs = db.MolecConseq -tests = db.Tests - - -# Create records - - -# READ records -# print(variants.find_one({"patientID":{"$in":["HG00403"]}})) - -# print(molconseqs.find_one({"patientID":"TCGA-DD-A1EH","variantID":{"$in": ["0a4f15c4b50b4d3799f223735029bf9c"]}})) - -# results=(molconseqs.aggregate([{"$match":{"patientID": "TCGA-DD-A1EH","variantID":{"$in":["0a4f15c4b50b4d3799f223735029bf9c"]}}}])) -# for result in results: -# print(result) - -matchPortion = {'$match':{'patientID':'TCGA-DD-A1EH','SPDI':{'$in':['NC_000001.10:27105549:C:T','NC_000001.10:27106893::T','NC_000007.13:41729606:G:A']}}} -lookupPortion = {'$lookup':{'from':'MolecConseq','let':{'myvariant_id':'$_id'},'pipeline':[{'$match':{'$expr':{'$and':[{'$or':[{'$eq':['$variantID','$$myvariant_id']}]}]}}}],'as':'molecularConsequenceMatches'}} -addFieldsPortion = {'$addFields':{}} -secondMatchPortion = {'$match':{'molecularConsequenceMatches':{'$exists':True,'$not':{'$size':0}}}} -query = [matchPortion,lookupPortion,addFieldsPortion,secondMatchPortion] -print(query) -results=(variants.aggregate(query)) -for result in results: - print(result) - -