Skip to content

Commit

Permalink
ss-main: added depedency
Browse files Browse the repository at this point in the history
  • Loading branch information
Sulstice committed Apr 2, 2022
1 parent deb3ec9 commit 7b60492
Show file tree
Hide file tree
Showing 4 changed files with 2,397 additions and 2 deletions.
31 changes: 30 additions & 1 deletion global_chem/global_chem/global_chem.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,11 @@ def get_all_nodes(self):
'''

return list(self.__NODES__.values())
# Skip the head node

nodes = [ i() for i in list(self.__NODES__.values())[1:] if i().name != 'common_regex_patterns' ]

return nodes

def get_node(self, node_key):

Expand Down Expand Up @@ -1225,4 +1229,29 @@ def print_deep_network(self):

print(PrintTreeUtilities.printTrees(_DEEP_NETWORK_KEY[ self.root_node ]))

def to_csv(self, out_file = 'global_chem.csv'):


'''
Convert the network into a CSV file in the format:
IUPAC, SMILES, NODE NAME, TREE PATH
'''

out_file = open(out_file, 'w')

all_nodes = self.get_all_nodes()

for node in all_nodes:

node_name = node.name
tree_path = node.__module__

for key, value in node.get_smiles().items():

out_file.write(f'{key}, {value}, {node_name}, {tree_path}\n')

out_file.close()

Loading

0 comments on commit 7b60492

Please sign in to comment.