Include SMILES string as a property field in the SDFile

ChemAxon e08c317633

22-03-2006 14:52:59

QUESTION (one of our users asked):





I also would like to include SMILES string as a property field in the SDFile when I convert a table of SMILES into a SDFile. My input file has two columns: SMILES string and name.





Input file example:


Code:
C       Methane


CC      Ethane


CCC     Propane


CCCC    Butane





ANSWER:





First you have to copy the SMILES strings into a new column.





Modified input file (alkanes.txt):


Code:
C       Methane     C


CC      Ethane      CC


CCC     Propane     CCC


CCCC    Butane      CCCC





Note: Use tabulators to separate columns. Otherwise, if spaces are used molconvert recognizes rows as two strings (example: "C" + "Methane C" ).





Then run molconvert with the following options:


Code:
molconvert sdf "alkanes.txt{fname,fID}" > mols.sdf





The output file (mols.sdf):


Code:



  Marvin  03220615312D         





  1  0  0  0  0  0            999 V2000


    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


M  END


>  <name>


Methane





>  <ID>


C





$$$$





  Marvin  03220615312D         





  2  1  0  0  0  0            999 V2000


    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


    0.8250    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


  1  2  1  0  0  0  0


M  END


>  <name>


Ethane





>  <ID>


CC





$$$$





  Marvin  03220615312D         





  3  2  0  0  0  0            999 V2000


    0.7145    0.1375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


    0.0000   -0.2750    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


   -0.7145    0.1375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


  1  2  1  0  0  0  0


  2  3  1  0  0  0  0


M  END


>  <name>


Propane





>  <ID>


CCC





$$$$





  Marvin  03220615312D         





  4  3  0  0  0  0            999 V2000


    1.0717    0.2063    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


    0.3572   -0.2063    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


   -0.3572    0.2063    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


   -1.0717   -0.2063    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0


  1  2  1  0  0  0  0


  2  3  1  0  0  0  0


  3  4  1  0  0  0  0


M  END


>  <name>


Butane





>  <ID>


CCCC





$$$$





The output file contains the names as a property field named "name" and the SMILES strings as a property field named "ID".