def main(): #FIXME, keep the rest, but need a new function from my own dictionary to build my records g = makeGraph('cell-merge', PREFIXES) #for i in range(0,len(keys)): #for j in range(0,len(js['LABELS'][0])): #print(js.keys()) keyList = [] for prefix, outer_identifiers in data.items(): if 'nlx_only' == prefix: continue for id_ in outer_identifiers: pre = prefix + ':' + id_ #if id_ not in js.keys(): #keyList.append(id_) #continue #if id_ == "nifext_128": #id_ == "sao1736323572" columns = js[id_][0] #print('num columns', len(columns), id_) for index, label in enumerate(js['LABELS']): mid = label #print(mid) if 'nlx_only' == prefix: right = columns else: right = columns[index] #print(right) if not right: continue #print(pre, mid, right) if ':' in right: right = right.replace(':', '') if ' ' in mid: mid = mid.replace(' ', '_') if type(right) == list: right = str(right) node = make_node(pre, mid, right) #print(node) g.add_node(*node) continue g.write()
def main(): #FIXME, keep the rest, but need a new function from my own dictionary to build my records g = makeGraph('cell-merge', PREFIXES) #for i in range(0,len(keys)): #for j in range(0,len(js['LABELS'][0])): #print(js.keys()) keyList=[] for prefix, outer_identifiers in data.items(): if 'nlx_only' == prefix: continue for id_ in outer_identifiers: pre = prefix + ':' + id_ #if id_ not in js.keys(): #keyList.append(id_) #continue #if id_ == "nifext_128": #id_ == "sao1736323572" columns = js[id_][0] #print('num columns', len(columns), id_) for index, label in enumerate(js['LABELS']): mid = label #print(mid) if 'nlx_only' == prefix: right = columns else: right = columns[index] #print(right) if not right: continue #print(pre, mid, right) if ':' in right: right=right.replace(':','') if ' ' in mid: mid=mid.replace(' ','_') if type(right)==list: right=str(right) node = make_node(pre, mid, right) #print(node) g.add_node(*node) continue g.write()
layer_rows_dict = {a[lli['Id']]: l_trans(a) for a in layer_rows} species_rows_dict = {a[sli['Id']]: s_trans(a) for a in species_rows} print(missing) #print(cell_rows_dict.keys()) def add_elements(record, rows, labels, id_): if id_ in rows: for label, element in zip(labels, rows[id_]): if element: record.append((label, element)) output = {} scigraph = set() for prefix, outer_identifiers in data.items(): for outer_identifier in outer_identifiers: record = [] # right now DNE duplicate rows record.append(('curie', prefix + ':' + outer_identifier)) if outer_identifier in cell_rows_dict: add_elements(record, cell_rows_dict, cell_labels, outer_identifier) elif outer_identifier in brain_rows_dict: add_elements(record, brain_rows_dict, brain_labels, outer_identifier) elif outer_identifier in layer_rows_dict: add_elements(record, layer_rows_dict, layer_labels, outer_identifier) else: raise TypeError('WHAT ????????????????') #missing.append(outer_identifier)
layer_rows_dict = {a[lli["Id"]]: l_trans(a) for a in layer_rows} species_rows_dict = {a[sli["Id"]]: s_trans(a) for a in species_rows} print(missing) # print(cell_rows_dict.keys()) def add_elements(record, rows, labels, id_): if id_ in rows: for label, element in zip(labels, rows[id_]): if element: record.append((label, element)) output = {} scigraph = set() for prefix, outer_identifiers in data.items(): for outer_identifier in outer_identifiers: record = [] # right now DNE duplicate rows record.append(("curie", prefix + ":" + outer_identifier)) if outer_identifier in cell_rows_dict: add_elements(record, cell_rows_dict, cell_labels, outer_identifier) elif outer_identifier in brain_rows_dict: add_elements(record, brain_rows_dict, brain_labels, outer_identifier) elif outer_identifier in layer_rows_dict: add_elements(record, layer_rows_dict, layer_labels, outer_identifier) else: raise TypeError("WHAT ????????????????") # missing.append(outer_identifier) # record.extend(['' for a in new_labels])