Highlighting substructure search hits

User d6ed1af950

20-09-2006 04:53:29

Hi,





I am using Marvin beans to carry out a substructure search. After the results are returned, I need to highlight the hit portions of the target structure.


I followed this link - http://www.chemaxon.com/forum/ftopic60.html&start=0&postdays=0&postorder=asc&highlight=





and went ahead with the same code, but still the highlighting of the hits is not ocurring.





Addition : Say if I do not want to view the structure in MViewPane but want to create the image of the highlighted hits structure, will the above code work?





Kindly help,





Thanks and Regards,


Ameya

ChemAxon 9c0afc9aaf

20-09-2006 05:16:36

Hi,





There was an interim bug in some test version(s) that the first (top left) cell of a molecule table in Marvin View was not colored.


(also applies if there is only a single cell)





Please try


Code:
<jchem_dir>\examples\java\HitAlignmentAndColoringExample.java



without modifications.





If it coloring does not work, the I suggest to try a different version (an official release or a later test version).





What is your current Marvin or JChem version ?





Best regards,





Szilard

User d6ed1af950

20-09-2006 05:27:24

Hi,





thanks for the reply. The JChem version is 3.1.





I added this the following in my original post....





Say if I do not want to view the structure in MViewPane but want to create the image of the highlighted hits structure, will the above code( indicated by the link in the 1st post) work?





Regards,





Ameya

ChemAxon 9c0afc9aaf

20-09-2006 08:05:51

Hi,
Quote:
Say if I do not want to view the structure in MViewPane but want to create the image of the highlighted hits structure, will the above code( indicated by the link in the 1st post) work?
No, it will not work.


This example specifies atom and bond sets for the Marvin display component (MViewPane).


This way the Molecule object does not know about this data, and colors will not be correctly represented during export.


(this wasn't a consideration at the time of writing the example)





I have updated the example to set these values for the molecule document object (MDocument). This way the coloring will be preserved correctly during image export.





The old method looked like this:





Code:



MViewPane mpan=new MViewPane();


mpan.setAtomSetColor(0, Color.black);


mpan.setAtomSetColor(1, Color.red);


mpan.setBondSetColor(1, Color.black);








The essence of the new method is:





Code:



Molecule target= ... ;


MDocument doc=new MDocument(target);


doc.setAtomSetRGB(0, Color.BLACK.getRGB() );


doc.setAtomSetRGB(1, Color.BLUE.getRGB() );


doc.setBondSetRGB(1, Color.BLACK.getRGB() );






(As you see I have also changed the color to BLUE, as RED is more problematic for people with color perception impairment)





Please find the modified source attached.





Best regards,





Szilard

User 7b0ee04e66

30-11-2006 16:47:13

Hi,





I am trying to do more or less the same thing and have included my code which works fine except that it does not highlight chiral bonds when my query is flat





Code:
                int[] hit = null;


                MolSearch ms = new MolSearch();


                ms.setHitIncludesRNodes(true);


                //ms.set


                ms.setQuery(query);


                ms.setTarget(target);


                hit = ms.findFirst();


               


                if (hit==null) {


                    System.err.println("Substructure not found");


                    return importer.importMol(mol.getSMILES()); //exits


                } else {


                    //hit atoms will be in set 1 , others remain in default set 0


                    for (int x=0; x<hit.length; x++) {


                        if (hit[x]>=0) {    //not implicit H


                            target.getAtom(hit[x]).setSetSeq(1);


                        }


                    }


               


                    //Using bond coloring to clear unwanted half bond colors:


                    ArrayList nhb=MolHandler.getNonHitBonds(query, target, hit);


                    for (int x=0; x<nhb.size(); x++) {


                        MolBond bond=(MolBond)nhb.get(x);


                        bond.setSetSeq(1);


                    }


                }






So if my query is CC1CO1, it will only highlight certain bonds in molecules like C[C@@H]1CCCC[C@]12CO2, or C1CC[C@@H]2O[C@H]2C1.





I have tried to include





ms.setExactStereoMatching(false);





but this makes no difference. Is there another option that would work?


Thanks for your help





Catherine

ChemAxon 9c0afc9aaf

01-12-2006 18:42:22

Dear Cathrine,





I think the problem is not with the coloring code, but the way Marvin displays the structure.


A the moment wedges are not colored at all.





You can also reproduce this at the following example:





http://www.chemaxon.com/marvin/doc/dev/example-view6.html





(Select "Adrenaline" and press "Select all" with a color)





Could you tell how serious / urgent problem is wedge coloring for you ?





My colleagues then will give you an estimated timeframe for the implementation.





Best regards,





Szilard

User 7b0ee04e66

04-12-2006 14:25:36

Hi,


Our users have requested this feature.


But at the moment, we will not implement it would be confusing for the user if chiral molecules are not highlighted.


Thanks


Catherine

ChemAxon d76e6e95eb

15-01-2008 09:58:56

The issue has been solved in Marvin and JChem 5.0 that is available for dowload.