Skip to content
Snippets Groups Projects
Commit b58171ef authored by AndiMajore's avatar AndiMajore
Browse files

fixed issue with strange gene name for proteins; fixed issue with empty string symbol for protein

Former-commit-id: 7c3269f46e87b959d7eca3040a1770a726c177b8 [formerly 9fe07622f02cc25506681f8c037c683613fcfc94]
Former-commit-id: 9216f0d0e81abdb11f965aa2d6b6c92be477f6db
parent cf4220c6
No related branches found
No related tags found
No related merge requests found
......@@ -96,16 +96,24 @@ class NedrexImporter:
if update:
self.cache.init_proteins()
def format_prot_name(name):
if '{' in name:
idx1 = name.index('{')
adjusted_name = name[:idx1 - 1].strip() if idx1 > 0 else ''
if '=' in adjusted_name:
idx2 = adjusted_name.index('=')
return adjusted_name[idx2+1:].strip()
return adjusted_name
return name
def add_protein(node):
id = to_id(node['primaryDomainId'])
name = node['geneName']
name = format_prot_name(node['geneName'])
gene = name
if len(node['synonyms']) > 0:
name = node['synonyms'][0]
if '{' in name:
idx = name.index('{')
if idx > 0:
name = name[:idx - 1]
proteins[id] = models.Protein(uniprot_code=id, protein_name=name, gene=node['geneName'])
name = format_prot_name(node['synonyms'][0])
proteins[id] = models.Protein(uniprot_code=id, protein_name=name, gene=gene)
def add_edges(edge):
id = to_id(edge['sourceDomainId'])
......
......@@ -215,20 +215,20 @@ def populate(kwargs):
print(f'Populated {n} DrDi associations from DrugBank.')
if kwargs['protein_protein']:
# print('Importing PPIs from unlicenced NeDRexDB...')
# n = NedrexImporter.import_protein_protein_interactions(importer,
# DatasetLoader.get_ppi_nedrex(nedrex_api_url_unlicenced, False),
# update)
# total_n += n
# print(f'Imported {n} PPIs from unlicended NeDRexDB')
# print('Importing PPIs from licenced NeDRexDB...')
# n = NedrexImporter.import_protein_protein_interactions(importer,
# DatasetLoader.get_ppi_nedrex(nedrex_api_url_licenced,
# True),
# update)
# total_n += n
# nedrex_update = True
# print(f'Imported {n} PPIs from licended NeDRexDB')
print('Importing PPIs from unlicenced NeDRexDB...')
n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_unlicenced, False),
update)
total_n += n
print(f'Imported {n} PPIs from unlicended NeDRexDB')
print('Importing PPIs from licenced NeDRexDB...')
n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_licenced,
True),
update)
total_n += n
nedrex_update = True
print(f'Imported {n} PPIs from licended NeDRexDB')
print('Populating PPIs from STRING...')
n = DataPopulator.populate_ppi_string(populator, DatasetLoader.get_ppi_string(), update)
total_n += n
......
......@@ -70,7 +70,8 @@ def aggregate_nodes(nodes: List[OrderedDict]):
for key, value in n.items():
if isinstance(value, list):
for e in value:
if e is not None and len(e) > 0:
node[key].add(e)
else:
elif value is not None and len(value) > 0:
node[key].add(value)
return {k: list(v) for k, v in node.items()}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment