<jupyter_start><jupyter_text>To load the dataset from memeory the ``MoleculeNetDataset`` class requires the information of the directory the data is in and the name of the csv-file. Also recommended is to provide a name of the dataset.<jupyter_code>dts = MoleculeNetDataset(file_name="data.csv", data_directory="ExampleMol/", dataset_name="ExampleMol")<jupyter_output><empty_output><jupyter_text>Precompute molecular features and cache the information to file in the same folder as provided in the class initialization.<jupyter_code>dts.prepare_data(overwrite=True, smiles_column_name="smiles", make_conformers=True)<jupyter_output>INFO:kgcnn: Generating molecules and store data.json to disk...
 ... converted molecules 0 from 4
done<jupyter_text>After ``prepare_data()`` is called, the cached mol-file can be read directly from the data-directory.<jupyter_code>dts.read_in_memory(label_column_name="Values1", add_hydrogen=False)
import networkx as nx
import rdkit.Chem as Chem
dts.node_number, dts.node_symbol
dts.edge_indices, dts.edge_number
G = nx.Graph()
G.add_nodes_from([(i, {"atom": x}) for i, x in enumerate(dts.node_symbol[3])])
G.add_edges_from(dts.edge_indices[3])
labels = nx.get_node_attributes(G, 'atom') 
nx.draw(G,labels=labels)
Chem.MolFromSmiles("CCCC=O")<jupyter_output><empty_output><jupyter_text>Adding further attributes from rdkit is possible using the ``set_attributes`` method<jupyter_code>dts.set_attributes(nodes=["Symbol", "TotalNumHs"], encoder_nodes = {"Symbol": OneHotEncoder(["C", "N", "O"], dtype="str", add_unknown=False)},
                   edges=["BondType", "Stereo"], encoder_edges = {"BondType": int},
                   graph=["ExactMolWt"]
                  )
dts.node_attributes
dts.edge_attributes
dts.graph_attributes<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11817168338907469, 'fraction_numerical': 0.002787068004459309, 'mean_word_length': 6.479166666666667, 'pattern_counts': {'":': 3, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '215453', 'license': 'MIT', 'n_tokens_mistral': 606, 'n_tokens_neox': 583, 'n_words': 140, 'path': 'notebooks/example_custom_moleculenet.ipynb', 'repo_name': 'aimat-lab/gcnn_keras', 'size': '1794'}