setcolors in toBinFormat

User 3afdb4ab90

01-12-2004 21:03:18

I need to convert smiles to jpeg with selected atoms colored.


I made some changes to the example code SimpleConverter.java.


I assign Set number 0 to all atoms, then Set 1 to selected atoms.


But when I use the (new) setcolors options in toBinFormat, e.g.


"jpeg:w200,setcolors", the output file is still colored by atom type,


the same as if I'd used "jpeg:w200". Do I need to define the


colors of my Sets? How do I do that?





Thanks,


TJ

ChemAxon 7c2d26e5cf

02-12-2004 15:42:31

Try this code. It works for me.


Code:



String selectedindexes = "0,1,2";


StringTokenizer selection = new StringTokenizer(selectedindexes,",");


while(selection.hasMoreTokens()) {


    String s = selection.nextToken();


    try{


        int index = Integer.parseInt(s);


        MolAtom a = mol.getAtom(index);


        a.setSetSeq(1);


    } catch(Exception e) {


        System.err.println("invalide index:"+s);


     }


}


// colors selected atoms


byte[] data = mol.toBinFormat("jpeg:w200,mono,setcolors");


User 3afdb4ab90

02-12-2004 17:47:11

Thanks, Tamas. I must have been working too late last night.


I added the code to setSetSeq AFTER the toBinFormat.


It's all working fine now.





TJ