-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Klaus Weinbauer
committed
Mar 13, 2024
1 parent
6c06b2e
commit 44dfeb4
Showing
8 changed files
with
136 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .query import get_functional_groups | ||
from .query import get_functional_groups, FGQuery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import networkx as nx | ||
import rdkit.Chem as Chem | ||
|
||
|
||
def mol_to_graph(mol: Chem.rdchem.Mol) -> nx.Graph: | ||
bond_order_map = { | ||
"SINGLE": 1, | ||
"DOUBLE": 2, | ||
"TRIPLE": 3, | ||
"QUADRUPLE": 4, | ||
"AROMATIC": 1.5, | ||
} | ||
g = nx.Graph() | ||
for atom in mol.GetAtoms(): | ||
g.add_node(atom.GetIdx(), symbol=atom.GetSymbol()) | ||
for bond in mol.GetBonds(): | ||
bond_type = str(bond.GetBondType()).split(".")[-1] | ||
g.add_edge( | ||
bond.GetBeginAtomIdx(), | ||
bond.GetEndAtomIdx(), | ||
bond=bond_order_map[bond_type], | ||
) | ||
return g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters