Convert RDF to SDF

User 9fa69eb201

31-10-2006 08:54:37

Dear All,





I have an RDF which is needed to convert into SDF. I dont have any problem in converting the root fields in RDF but when it comes to fields in table part i am facing with the problem of how to loop the program so that all fields in table are read.





I am describing the problem below





1) This i don't have any problem with the following one





$DTYPE ROOT:ID


$DATUM 1





2) I want solution for the following one





$DTYPE ROOT:INVENTORY(1):NAME


$DATUM XYZ


$DTYPE ROOT:INVENTORY(1):QUANTITY


$DATUM 10gm


$DTYPE ROOT:INVENTORY(2):NAME


$DATUM ABC


$DTYPE ROOT:INVENTORY(2):QUANTITY


$DATUM 50gm





I want to know how many times each field in a table is present in RDF and loop it so many times to get data to write in the following format





> <NAME_1>


XYZ


> <QUANTITY_1>


10gm


> <NAME_2>


ABC


> <QUNATITY_2>


50gm





Thanking you in Advance





Anil

User 9fa69eb201

03-11-2006 05:42:08

Dear All,





Can anyone help on this as i have to use the molecules with different activities in the docking and QSAR studies. I am able to convert the root fields but i am not getting how to convert the table fields with multiple rows into flat file format of SDF.





Please help





Anil

ChemAxon 7c2d26e5cf

03-11-2006 22:48:31

Indeed, Marvin does not support converting these fields into SD file.


We are checking the issue.

User 9fa69eb201

04-11-2006 04:33:18

Dear All,





I thank Tamas for the response but i have a small idea how to do it. may be this can help you.





Please find the attached Program which finds how many properties are present in a given RDF and prints out the unique property keys.





I want to use this to get the values of properties to print out in flat file SDF format. I can get the root fields like ID (in sample RDF) to print in SDF but when it comes to STOCK table, i want to know for each molecule how many properties (each single one) are present for the given molecule and how to loop it around the molecule to get the same.





I attach sample program and also the sample RDF.





Thanks in Advance





Anil

ChemAxon 7c2d26e5cf

08-11-2006 14:40:12

If you write a custom code, you can change the name of fields:


Code:
// save RDfile properties into a temporary object


int pcount = molecule.getPropertyCount();


Enumeration keys = molecule.getPropertyKeys();


Object[][] table = new Object[pcount][2];


for(int i=0;i<table.length;i++) {


    String key = (String)keys.nextElement();


    table[i] = new Object[]{ key, molecule.getProperty(key) };


}





// delete all RDfile properties of the molecule


molecule.clearProperties();





// add old properties with new names


for(int i=0;i<table.length;i++) {


      String key = (String)table[i][0];


      Object value = table[i][1];


      String newkey;


      // generate new name from old one


      ...


      molecule.setPropertyObject(newkey,value);


}





// convert to SDfile format


System.out.println(molecule.toFormat("sdf"));