Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}})
yield _obj
else:
variant_id = cp.ReferenceClinVarAssertion.MeasureSet.ID
for _measure in cp.ReferenceClinVarAssertion.MeasureSet.Measure:
json_obj = parse_measure(_measure, hg19=hg19)
if json_obj:
json_obj['clinvar']['rcv'].update({'accession': rcv_accession,
'clinical_significance': clinical_significance,
'number_submitters': number_submitters,
'review_status': review_status,
'last_evaluated': str(last_evaluated),
'origin': origin,
'conditions': conditions})
json_obj['clinvar'].update({'variant_id': variant_id})
json_obj = (dict_sweep(unlist(value_convert_to_number(json_obj,
['chrom', 'omim', 'id', 'orphanet', 'gene',
'rettbase_(cdkl5)', 'cosmic', 'dbrbc'])), [None, '', 'None']))
yield json_obj
if _flag == 0:
restr_dict['chembl'] = dictionary
if 'cross_references' in restr_dict['chembl'] and restr_dict['chembl']['cross_references']:
restr_dict['chembl']['xrefs'] = restructure_xref(restr_dict['chembl']['cross_references'])
del restr_dict['chembl']['molecule_structures']
del restr_dict['chembl']['cross_references']
restr_dict = unlist(restr_dict)
# Add "CHEBI:" prefix, standardize the way representing CHEBI IDs
if 'chebi_par_id' in restr_dict['chembl'] and restr_dict['chembl']['chebi_par_id']:
restr_dict['chembl']['chebi_par_id'] = 'CHEBI:' + str(restr_dict['chembl']['chebi_par_id'])
else:
# clean, could be a None
restr_dict['chembl'].pop("chebi_par_id",None)
restr_dict = dict_sweep(restr_dict, vals=[None,".", "-", "", "NA", "None","none", " ", "Not Available", "unknown","null"])
restr_dict = value_convert_to_number(restr_dict, skipped_keys=["chebi_par_id","first_approval"])
restr_dict = boolean_convert(restr_dict, ["topical","oral","parenteral","dosed_ingredient","polymer_flag",
"therapeutic_flag","med_chem_friendly","molecule_properties.ro3_pass"])
return restr_dict
def restructure_dict(dictionary):
restr_dict = dict()
restr_dict['_id'] = dictionary['ChEBI ID']
restr_dict['chebi']= dictionary
restr_dict['chebi'] = clean_up(restr_dict['chebi'])
restr_dict = dict_sweep(restr_dict,vals=[None,".", "-", "", "NA", "none", " ", "Not Available",
"unknown","null","None","NaN"])
restr_dict = value_convert_to_number(unlist(restr_dict),skipped_keys=[
"beilstein","pubmed","sabio_rk","gmelin","molbase", "synonyms", "wikipedia","url_stub"])
return restr_dict
restr_dict['chembl'] = dictionary
_flag=1
for x,y in iter(dictionary['molecule_structures'].items()):
if x == 'standard_inchi_key':
restr_dict['chembl'].update(dictionary)
restr_dict['chembl'].update({'inchi_key':y})
if x == 'canonical_smiles':
restr_dict['chembl']['smiles'] = y
if x == 'standard_inchi':
restr_dict['chembl']['inchi'] = y
if _flag == 0:
restr_dict['chembl'] = dictionary
del restr_dict['chembl']['molecule_structures']
restr_dict = unlist(restr_dict)
restr_dict = dict_sweep(restr_dict, vals=[None,".", "-", "", "NA", "None","none", " ", "Not Available", "unknown","null"])
restr_dict = value_convert(restr_dict, skipped_keys=["chebi_par_id","first_approval"])
restr_dict = boolean_convert(restr_dict, added_keys=["topical","oral","parenteral",
"dosed_ingredient","polymer_flag","therapeutic_flag","med_chem_friendly","ro3_pass"])
return restr_dict
"drugbank.weight.average",
"drugbank.predicted_properties.molecular_weight",
"drugbank.predicted_properties.monoisotopic_weight"])
# Mixed types coerced to floats
restr_dict = float_convert(restr_dict,
include_keys=[
"drugbank.experimental_properties.logp",
"drugbank.experimental_properties.logs",
"drugbank.predicted_properties.logp",
"drugbank.predicted_properties.logs",
"drugbank.predicted_properties.pka_(strongest_basic)",
"drugbank.predicted_properties.pka_(strongest_acidic)",
"drugbank.predicted_properties.refractivity",
"drugbank.predicted_properties.polarizability",
"drugbank.predicted_properties.polar_surface_area_(psa)"])
restr_dict = dict_sweep(restr_dict,vals=[None,math.inf,"INF",".", "-", "", "NA", "none", " ",
"Not Available", "unknown","null","None"])
return restr_dict