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 24, 2024
1 parent 241dd30 commit 51c7a1d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/hub/dataload/sources/civic/civic_parser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import requests
import json
import time
import glob
import os
import logging
from utils.hgvs import get_hgvs_from_vcf
from biothings.utils.dataload import unlist, dict_sweep, to_int
from biothings.utils.dataload import unlist, dict_sweep


def merge_dicts(d1, d2):
Expand Down Expand Up @@ -33,6 +30,8 @@ def remove_nodes_and_edges(obj):
if 'edges' in obj:
return [remove_nodes_and_edges(edge['node']) for edge in obj['edges']]

if 'nodes' in obj:
return [remove_nodes_and_edges(node) for node in obj['nodes']]
return {
key: remove_nodes_and_edges(value)
for key, value in obj.items()
Expand Down Expand Up @@ -88,7 +87,6 @@ def load_data(data_folder):
new_doc["civic"].pop("myVariantInfo")
new_doc = remove_nodes_and_edges(new_doc)
new_doc["civic"]["molecularProfiles"] = new_doc["civic"]["molecularProfiles"]["nodes"]
new_doc["civic"]["v"] = "1.0"
yield dict_sweep(unlist(new_doc), ['', 'null', 'N/A', None, [], {}])

logging.info("number of ids with ref, alt, chrom: {}".format(no_case1))
Expand Down

0 comments on commit 51c7a1d

Please sign in to comment.