how to use HitDisplayUtil function

User 37df300f74

23-02-2010 21:28:37

I have a scaffold structure defined with R1 and R2, then I try to aligh/color my library against this structure. From Marvin API, HitDisplayUtil has color and align function, but the result is not what I expected.


here is the code I used, core is scaffold molecule object with R1, R2 attached. I did not get scaffold structure colored as green, only one atom was colored green. I even try to get Molatom array from core and replace R1, R2 atoms using ANY, but did not work.


Could you point me to a right direction?


Thanks


Hongzhou




if (atomArray.getAtno()==MolAtom.RGROUP)


{


MolAtom a =new MolAtom(MolAtom.ANY);


array=a;


}




HitColoringAndAlignmentOptions option =new HitColoringAndAlignmentOptions();


option.coloring =true;


option.hitColor =Color.GREEN;


option.nonHitColor=Color.RED;


option.alignmentMode =HitColoringAndAlignmentOptions.ALIGNMENT_ROTATE;


HitDisplayUtil.color(core, mol, option);

ChemAxon 9c0afc9aaf

01-03-2010 06:23:41

Hi,


 


HitDisplayUtil is designed to color substructures taking into account connections in the query an paying attention which half bonds should be colored. 


Your case seems to be different, you want to color certain atoms, and not a substructure search result.


You can define atom sets and their colors via the MDocument object (can be obtained from the Molecule):


http://www.chemaxon.com/marvin/help/developer/beans/api/chemaxon/struc/MDocument.html


http://www.chemaxon.com/marvin/help/developer/beans/api/chemaxon/struc/MDocument.html#setAtomSetRGB(int, int)


This method of MolAtom sets the set number (set 0 is default, not colored):


http://www.chemaxon.com/marvin/help/developer/beans/api/chemaxon/struc/MolAtom.html#setSetSeq(int)


The coloring can also be preserved outside Java (e.g. if needed in a web page as applet parameter) : a Molecule exported to the MRV file format will contain all the color information. 

User 37df300f74

01-03-2010 19:15:38

Thanks for reply.


I do care substructure and I need to align along and color substructure. but since I have R1, R2 defined in my query, I change the  related query atom to ANY first in order to get hit from target molecule.

ChemAxon 9c0afc9aaf

01-03-2010 19:30:08

Hi,


Sorry I misunderstood the situation.


Could you let us know the exact Marvin version you are using and  possibly provide the query and target structure ?


(if confidential please send to our support e-mail linked at the top of the forum page)


Best regards,


Szilard

User 37df300f74

01-03-2010 19:41:42

I attached an image containing a scaffold structure and target molecule. We like to aligh target to scaffold and also color any atom/bond common to scaffold. I changed R1, R2 to ANY before calling coloring function.


Thanks

ChemAxon a9ded07333

02-03-2010 11:28:27

Hi,


Unfortunately you use a public method in HitDisplayUtil that is designed only for internal use but it's not mentioned in the API doc. We will add warning to the API doc.


On the other side, HitDisplayUtil is designed for coloring structures when the matching atoms in target are given by a hit list (see HitDisplayUtil.color(Molecule, Molecule, int[], HitColoringAndAlignmentOptions) ). If you don't have a hit list - like in your case -, you should use HitDisplayTool as described here:



http://www.chemaxon.com/jchem/doc/guide/utils/index.html#hitcoloring ("Visualization of hits")


You can also find a detailed example here.


Using HitDisplayTool you don't have to replace R1 and R2 by ANY atoms since they will match by default any atom.


Write me if you need further help.


Regards,
Tamás


User 37df300f74

02-03-2010 14:13:00

Hi Tamas,


Thanks for your suggestion. In my another post related to Marvin.Net, I mentioned that we have global license on Marvin, but no JChem. You said we can reference JChem.Net to use this function, so just want to confirm with you that we can use JChem.jar in Java side as well.


Hongzhou


 


 


 


 

ChemAxon a9ded07333

03-03-2010 11:33:10

Hi Hongzhou,


Unfortunately you need a Search license to use HitDisplayTool as it performs an internal search to identify the position of the query in the target. Otherwise the solution is using JChem jar files.


In Marvin you can still you use the HitDisplayUtil.color() method, but you have to figure out somehow (e.g. MarvinView - View menu - Misc. - Atom numbers) the matching atom indexes of target (atom index = atom number - 1):


HitDisplayUtil.color(core, mol, new int[]{0,1,2,3,4,5,6,13,7,8,9,10,11,12}, option);

No need of replacing R atoms.


Regards,
Tamás


P.S. It was Tamás Pelcz who answered you in your other forum topic :)