Re: [Rdkit-discuss] edge matrix

2018-01-18 Thread Jan Halborg Jensen
it Discuss Objet : Re: [Rdkit-discuss] edge matrix Is there a function for the reverse process, i.e. getting a molecule object from an adjacency matrix? Best regards, Jan On 17 Jan 2018, at 17:19, Guillaume GODIN <guillaume.go...@firmenich.com<mailto:guillaume.go...@firmeni

Re: [Rdkit-discuss] edge matrix

2018-01-18 Thread Guillaume GODIN
Dear Jan, There is not such kind of function in RDKit. BR, Guillaume De : Jan Halborg Jensen Date : jeudi, 18 janvier 2018 à 11:17 À : GVALMTGG Cc : Mario Lovrić, RDKit Discuss Objet : Re: [Rdkit-discuss] edge matrix Dear Guillaume I understand that the adjacency matrix, together

Re: [Rdkit-discuss] edge matrix

2018-01-18 Thread Jan Halborg Jensen
Is there a function for the reverse process, i.e. getting a molecule object from an adjacency matrix? Best regards, Jan On 17 Jan 2018, at 17:19, Guillaume GODIN > wrote: Dear Mario, There is a adjacency matrix available:

Re: [Rdkit-discuss] edge matrix

2018-01-18 Thread Guillaume GODIN
ipal it’s only what you need. BR, Guillaume De : Jan Halborg Jensen Date : jeudi, 18 janvier 2018 à 10:59 À : GVALMTGG Cc : Mario Lovrić, RDKit Discuss Objet : Re: [Rdkit-discuss] edge matrix Is there a function for the reverse process, i.e. getting a molecule object from an adjacency matr

Re: [Rdkit-discuss] edge matrix

2018-01-18 Thread Mario Lovrić
Dear Chris, Thanks, thats it :) On Wed, Jan 17, 2018 at 6:25 PM, Chris Earnshaw wrote: > I don't think there's a way to do this using RDKit itself, but it appears > to be straightforward using Python with numpy and networkx, e.g. > > import numpy as np > import networkx

Re: [Rdkit-discuss] edge matrix

2018-01-17 Thread Chris Earnshaw
I don't think there's a way to do this using RDKit itself, but it appears to be straightforward using Python with numpy and networkx, e.g. import numpy as np import networkx as nx a = np.matrix([[0, 1, 0, 0, 0],[1, 0, 1, 1, 0],[0, 1, 0, 0, 0],[0, 1, 0, 0, 1],[0, 0, 0, 1, 0]]) b =

Re: [Rdkit-discuss] edge matrix

2018-01-17 Thread Mario Lovrić
Correct, I am looking for a rdkit-hidden-option to do it :D On Wed, Jan 17, 2018 at 5:56 PM, Jason Biggs wrote: > I am a novice when it comes to graph theory, but it seems like what is > wanted here is the adjacency matrix of the corresponding line graph ( >

Re: [Rdkit-discuss] edge matrix

2018-01-17 Thread Jason Biggs
I am a novice when it comes to graph theory, but it seems like what is wanted here is the adjacency matrix of the corresponding line graph ( http://mathworld.wolfram.com/LineGraph.html). I don't know how to do this in python, but if I use mathematica, it goes like this adjacencyMatrix = {{0, 1,

Re: [Rdkit-discuss] edge matrix

2018-01-17 Thread Mario Lovrić
Dear Marta and Guillaume, Thank you both. Your solutions are giving the same output, which is the vertices-adjacency matrix. There is something called the edge-adjaceny matrix. Its defined in several papers by Trinajstic to calculate the M2 Zagreb indices, eg. "The Zagreb Indices 30 Years After"

Re: [Rdkit-discuss] edge matrix

2018-01-17 Thread Marta Stępniewska-Dziubińska via Rdkit-discuss
Hi Mario, What exactly do you mean by 'edge matrix'? Are you sure you provided a correct example? If you want to get an adjacency matrix of a molecular graph you can iterate over bonds to get it: from rdkit.Chem import MolFromSmiles import numpy as np m = MolFromSmiles('CC(C)CC') n =

Re: [Rdkit-discuss] edge matrix

2018-01-17 Thread Guillaume GODIN
Dear Mario, There is a adjacency matrix available: from rdkit import Chem mol = Chem.MolFromSmiles('CC(C)CC') adj = Chem.GetAdjacencyMatrix(mol) print adj [[0 1 0 0 0] [1 0 1 1 0] [0 1 0 0 0] [0 1 0 0 1] [0 0 0 1 0]] But this is not what you want… Can you explain your output