Skip to content

Commit

Permalink
Remove items called node and edges.
Browse files Browse the repository at this point in the history
  • Loading branch information
everaldorodrigo committed Oct 25, 2024
1 parent 457276d commit c269c5d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/hub/dataload/sources/civic/civic_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,40 @@ def remove_nodes_and_edges(data):


# number of civic ids from MyVariantInfo
no_case1 = 0
civic_no_case1 = 0
# number of civic ids from CivicDB.org
no_case2 = 0
civic_no_case2 = 0
# number of civic ids not found
no_case3 = 0
civic_no_case3 = 0
# number of civic ids created by exception
no_case4 = 0
civic_no_case4 = 0


def get_id(doc):
global no_case1
global no_case2
global no_case3
global no_case4
global civic_no_case1
global civic_no_case2
global civic_no_case3
global civic_no_case4
try:
if "myVariantInfo" in doc and "myVariantInfoId" in doc["myVariantInfo"]:
_id = doc["myVariantInfo"]["myVariantInfoId"]
no_case1 = no_case1 + 1
civic_no_case1 = civic_no_case1 + 1
return _id
elif "hgvsDescriptions" in doc:
hgvs_description = doc["hgvsDescriptions"]
hgvs_nc_item = hgvs_description[0].split(":")
nc_id = hgvs_nc_item[0].replace("NC_", "").split(".")[0].lstrip('0')
_id = nc_id + hgvs_nc_item[1]
no_case2 = no_case2 + 1
civic_no_case2 = civic_no_case2 + 1
return _id
else:
_id = 'CIVIC_VARIANT:' + str(doc["id"])
no_case3 = no_case3 + 1
civic_no_case3 = civic_no_case3 + 1
return _id
except Exception as e:
logging.error(e)
_id = 'CIVIC_VARIANT:' + str(doc["id"])
no_case4 = no_case4 + 1
civic_no_case4 = civic_no_case4 + 1
return _id


Expand All @@ -86,7 +86,7 @@ def load_data(data_folder):
# new_doc["civic"]["molecularProfiles"] = new_doc["civic"]["molecularProfiles"]["nodes"]
yield dict_sweep(unlist(new_doc), ['', 'null', 'N/A', None, [], {}])

logging.info("number of civic ids from MyVariantInfo: {}".format(no_case1))
logging.info("number of civic ids from CivicDB.org: {}".format(no_case2))
logging.info("number of civic ids not found: {}".format(no_case3))
logging.info("number of civic ids created by exception: {}".format(no_case4))
logging.info("number of civic ids from MyVariantInfo: {}".format(civic_no_case1))
logging.info("number of civic ids from CivicDB.org: {}".format(civic_no_case2))
logging.info("number of civic ids not found: {}".format(civic_no_case3))
logging.info("number of civic ids created by exception: {}".format(civic_no_case4))

0 comments on commit c269c5d

Please sign in to comment.