Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean attributes are treated as integers when converting networkx to NiceCXNetwork #83

Closed
coleslaw481 opened this issue Jun 15, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@coleslaw481
Copy link
Contributor

coleslaw481 commented Jun 15, 2021

When using the method: ndex2.create_nice_cx_from_networkx() Boolean attributes are sometimes treated as integers. This was tested with networkx version 2.5.1

import ndex2
import networkx as nx

#Create a networkx graph with a boolean attribute
G = nx.Graph()
G.add_node(1, isRoot=False)
nx.get_node_attributes(G, 'isRoot')

print(ndex2.create_nice_cx_from_networkx(G).to_cx())

When run got this output:

[{'numberVerification': [{'longNumber': 281474976710655}]},
 {'metaData': [{'name': 'nodes',
    'elementCount': 1,
    'idCounter': 1,
    'version': '1.0',
    'consistencyGroup': 1,
    'properties': []},
   {'name': 'nodeAttributes',
    'elementCount': 1,
    'idCounter': 1,
    'version': '1.0',
    'consistencyGroup': 1,
    'properties': []}]},
 {'nodes': [{'@id': 1, 'n': 1}]},
 {'nodeAttributes': [{'po': 1, 'n': 'isRoot', 'v': False, 'd': 'integer'}]},
 {'status': [{'error': '', 'success': True}]}]

The data type d for the nodeAttribute should be a boolean and NOT an integer

Extracted from: https://ndexbio.atlassian.net/browse/UD-1753

@coleslaw481 coleslaw481 self-assigned this Jun 15, 2021
@coleslaw481 coleslaw481 added this to the 3.5.0 milestone May 5, 2022
coleslaw481 added a commit that referenced this issue May 18, 2022
…ctored code to just use if statements and returns vs if elif
@coleslaw481
Copy link
Contributor Author

Fixed with commit:
To github.com:ndexbio/ndex2-client.git
5c899e5..1a6873e v3.5.0 -> v3.5.0

coleslaw481 added a commit that referenced this issue May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant