User 37df300f74
19-08-2005 14:00:46
Suppose I calculate descriptors for each atom in a molecule, how can I show atom with descriptors values in MViewPane?
Thanks a lot
Thanks a lot
User 37df300f74
19-08-2005 14:00:46
ChemAxon 9c0afc9aaf
22-08-2005 10:27:46
User 37df300f74
22-08-2005 13:11:53
ChemAxon a3d59b832c
22-08-2005 15:13:48
Quote: |
<?xml version="1.0" encoding="Cp1252" ?> <MDocument> <MChemicalStruct> <molecule molID="m1"> <atomArray atomID="a1 a2 a3 a4 a5" elementType="N C C C C" mrvExtraLabel="18.00 . . . ." x2="-3.9666666984558105 -5.3003066984558105 -2.6330266984558106 -2.6330266984558106 -5.3003066984558105" y2="-0.006999976158141408 0.7630000238418582 0.7630000238418582 2.3030000238418573 2.3030000238418573" /> <bondArray> <bond atomRefs2="a1 a2" order="1" /> <bond atomRefs2="a1 a3" order="1" /> <bond atomRefs2="a2 a5" order="2" /> <bond atomRefs2="a5 a4" order="1" /> <bond atomRefs2="a4 a3" order="2" /> </bondArray> </molecule> </MChemicalStruct> </MDocument> |
User 37df300f74
23-08-2005 15:36:07
User 870ab5b546
10-01-2007 20:13:49
ChemAxon a3d59b832c
11-01-2007 10:43:29
bobgr wrote: |
Suppose I want to store a number for each atom, but I do not want to show the numbers to the user? Is there a field that I can use? I can't just make up my own field, because I need the data to be retained when the user modifies the molecule and Marvin sends it back to the server. |
User 870ab5b546
11-01-2007 12:05:32
ChemAxon 7c2d26e5cf
11-01-2007 20:43:15
ChemAxon a3d59b832c
12-01-2007 08:31:44
ChemAxon a3d59b832c
12-01-2007 09:21:49
Code: |
package test; import chemaxon.struc.Molecule; import chemaxon.struc.MolAtom; import chemaxon.struc.Sgroup; import chemaxon.struc.sgroup.DataSgroup; import chemaxon.formats.MolImporter; import chemaxon.formats.MolFormatException; /** * @author Szabolcs Csepregi Date: 12-Jan-2007 */ public class DataSgroupT { static String mol = "C1CCCCC1"; public static void main(String[] args) throws MolFormatException { Molecule m = MolImporter.importMol(mol); // Adding data sgroups to each atom: for (int i = 0; i < m.getAtomCount(); i++) { addSgropToAtom(m, i); }//end for(i) System.err.println(m.toFormat("mrv")); System.err.println(m.toFormat("mol")); // Accessing data sgroups: for (int i = 0; i < m.getAtomCount(); i++) { printData(m, i); }//end for(i) }//end main /** * Prints out all data sgroups that atom i is part of. */ private static void printData(Molecule m, int i) { MolAtom molatom = m.getAtom(i); for (int j = 0; j < m.getSgroupCount(); j++) {// Go through all sgroups Sgroup sg = m.getSgroup(j); if (sg.getType() == Sgroup.ST_DATA) {// If data sgroup DataSgroup dsg = (DataSgroup) sg; if (dsg.indexOf(molatom) != -1) {// Is the data attached to molatom? System.err.println("Atom " + i + " has attached data:" + " field name:" + dsg.getFieldName() + " data:" + dsg.getData()); } } }//end for(j) } private static void addSgropToAtom(Molecule m, int i) { MolAtom ma = m.getAtom(i); DataSgroup ds = new DataSgroup(m); ds.setData(Integer.toString(i)); ds.setFieldName("ATOM_INDEX"); // To hide the data sgroup: ds.setDisplayedLines(-2); // This adds ma to ds and puts ds into m, if necessary: m.setSgroupParent(ma, ds, true); } }//end class DataSgroupT |
User 870ab5b546
12-01-2007 13:34:10
ChemAxon a3d59b832c
12-01-2007 13:37:15
bobgr wrote: |
One question: Is the displayed lines = -2 option a feature that has already been implemented, or is it something you plan to introduce in the future? |
ChemAxon e500b51457
13-02-2007 20:47:00