a renumbering problem

User 870ab5b546

17-08-2004 20:15:34

I acquire a Marvin 3.5 file that contains both one or more structures and some electron-flow arrows. I find that the structures in the acquired file are identical to the structures in a reference file. I want to renumber the atoms in the acquired file so that each one has the same number as the corresponding atom in the reference file, without making the electron-flow arrows point to the wrong atoms. Or, which is the same thing, I want to add electron-flow arrows to the reference file so that the arrows point to the same atoms as they do in the acquired file.





Any ideas how to do it? The problem seems to require a recursive substructure search of some kind.

ChemAxon fb166edcbd

18-08-2004 12:38:50

bobgr wrote:



Any ideas how to do it? The problem seems to require a recursive substructure search of some kind.
If I got it right you want a correspondence between atom indexes of two molecules representing the same molecule structures. Yes, this requires substructure search with exact matching. We have chemaxon.sss.search.MolSearch for this purpose but it is in jchem and not in marvin. If you have jchem then you can do the trick in the following way:





Code:






// create a searcher with exact matching


MolSearch search = new MolSearch();


search.setSubgraphSearch(false); // exact matching





// set the molecules, one as target, the other one as query


search.setTarget(mol1);


search.setQuery(mol2);





// find the first match


int[] hit = search.findFirst();


if (hit != null) {


    // hit[i] is the mol1 atom index corresponding to atom i in mol2


    // if hit[i] is negative then atom i in mol2 is an explicit H matching


    // an implicit H attached to atom -hit[i] in mol1,


    // or to atom 0 in mol1 if hit[i] is Integer.MIN_VALUE


}











You can call search.findNext(); to get the other possible matches - there are more than one matches if the structure is symmetrical.





You can download jchem from http://www.chemaxon.com/jchem