Skip to content

Commit

Permalink
(#114) add opposite label with !> symbol to motif_source
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhan committed Jan 19, 2023
1 parent e2389ed commit 15efb56
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions neuronal_motifs/server/utils/data_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def nodes_and_edges_to_motif_string(motif):

rois = fetch_all_rois()
# First list every edge like A -> B [weight > x]
edgeLabels = []
for edge in edges:
edge_str = edge['label']
edgeLabels.append(edge['label'])
if 'properties' in edge and edge['properties'] is not None:
edge_str += ' ['
for i, prop in enumerate(list(edge['properties'].items())):
Expand All @@ -106,6 +108,16 @@ def nodes_and_edges_to_motif_string(motif):
edge_str += ']'
edge_str += ' \n'
output += edge_str

# Check opposite direction of edge
# https://github.com/aplbrain/dotmotif/wiki/Monomorphism-and-Isomorphism#considerations-for-motif-search
for label in edgeLabels:
start, arrow, end = label.split(' ')
oppositeLabel = ' '.join([end, arrow, start])
if oppositeLabel not in output:
output += ' '.join([end, '!>', start]) + ' \n'
print(output)

# Now list every node property like A['prop'] == True
for node in nodes:
node_str = str(node['label']) + '.status = "Traced" \n'
Expand Down

0 comments on commit 15efb56

Please sign in to comment.