User c0bc45fec0
30-03-2007 12:53:51
Hi everybody,
I try to convert a sdf file containing thousands of compounds into multiple mol file (with for example an automatic number file name).
I read the help file but there's only the function to convert multiple mol files to a unique sdf file.
Have you got any idea for doing this type of conversion ?
Thanks !
Alex
ChemAxon 7c2d26e5cf
05-04-2007 13:48:52
Try the attached example.
User c0bc45fec0
05-04-2007 14:07:12
Thank you for your help,
I used perl scripts in order to do this type of conversion but I'll try your script.
Alexandre
User 677b9c22ff
14-07-2007 09:38:54
Hi,
thats what I call redundant or duplicate work.
I tried to find "sdf2mol" (SDF to mol) on the internet but only could find
one reference to a (non-existing) python file.
I remember that I could convert SDF files to mol and jpeg
and png etc with SDF-toolkit, OpenBabel or any perl or
python script. But I tried and either could not find it or
bring it to work. So I started to code for some minutes and
then came across other examples here and there was the
code already :-)
Long explanation short story.
This sdf2mol converts a single SD file (SDF) or SMI file (SMILES) to multiple mol, pdf, png etc. files
So this code is also a SDF2png, SDF2bmp, SDF2mol, SDF2pdf, SDF2cml
SMI2mol, SMI2png, SMI2pdf, SMI2cml.
So virtually all formats molconvert also supports.
SDF2mol converts large SDF or SMILES files into multiple single mol files or pictures
usage: SDF2mol inputname outputname format
example: SDF2mol C6H6.sdf C6H6mol mol
example: SDF2mol C6H6.smi C6H6pic png
example: SDF2mol C6H6.sdf C6H6out mol:-H
/* The input file format is guessed automatically or specified as an import option
* to the constructor. Many different formats are supported like
* "mol", "rgf", "sdf", "rdf", "csmol", "csrgf", "cssdf", "csrdf", "cml", "mrv",
* "smiles", "cxsmiles", "pdb", "xyz" "sybyl", "mol2", "pdb", "xyz"
* Output molecule formats: mol, rgf, sdf, rdf, csmol, csrgf, cssdf, csrdf, cml,
* Output Graphics formats: emf, jpeg, msbmp, pdf, png, pov, ppm, svg.
* Other formats: gzip, base64. (See -Ho)
* MolImporter can also import gzip compressed and base64 encoded structures.
*/
/*
* Basic export options
a, +a, +a_gen General aromatization. Example: "XXX:a"
a_bas Basic aromatization. Example: "XXX:a_bas"
-a Dearomatize. Example: "XXX:-a"
H or +H Add explicit Hydrogen atoms. Example: "XXX:H"
-H Remove explicit Hydrogen atoms. Example: "XXX:-H"
Here, XXX can be any molecule or image format like
mol, sdf, rdf, rgf, rxn, csmol, cssdf, csrdf, csrgf, csrxn,
smiles, cxsmiles, abbrevgroup, mrv, cml, jpeg, png, ppm or svg, msbmp
but aromatization options have no effect on formats which
do not store bond orders like cube, pdb and xyz.
*/
See the attached sdf2mol.java and sdf2mol.bat and
sdf2mol.jar. So if you want to create a mol file
use SDF2mol.bat C6H6-cdk.smi C6H6mol mol
or if you want to create multiple pictures (png,jpeg,bmp)
use SDF2mol.bat c6h6-cdk.smi c6h6 png
The output print should be like that:
SDF2mol 2007 v1.0 - CPUs:8
Number of molecules in C6H6-cdk.smi: 217
Created 217 new mol files. Thank you for using SDF2mol!
Kind regards
Tobias
User 677b9c22ff
10-09-2007 20:08:16
Hi,
I just found out that some of the options for converting pictures,
like SDF2png or SDF2JPG do not work with SDF2MOL (creates 0 length pictures).
Code: |
sdf2mol input.sdf outputname "png:w300,#ffffff,-a,-H"
sdf2mol input.sdf outputname "jpeg:q100,w300,#ffffff,-a,-H"
|
It only works without options
Code: |
sdf2mol input.sdf outputname png
sdf2mol input.sdf outputname jpeg
|
Or 1) converting to mol and 2) converting to png, JPG with options
(like different colors, width, background)
Code: |
(1)
sdf2mol input.sdf outputname mol
(2)
create a windows batchfile doconvert.bat
for %%f in (*.mol) do molconvert "png:w300,#ffffff,-a,-H" %%f -o %%f.png
|
This will convert all the pictures with the possible and correct options.
This mode works good for most purposes.
Tobias
ChemAxon 7c2d26e5cf
11-09-2007 22:00:31
The error is in your code.
You should parse format string. Skip export options (":w300,#ffffff,-a,-H") from the file name extension:
Code: |
int x = format.indexOf(":");
String ext = (x > -1)? format.substring(0,x) : format;
localfilename = outputname+ "-" + (molcounter)+ "." + ext; |
User 677b9c22ff
12-09-2007 01:45:01
Hi Tamas,
once you know its easy :-) I did it the easy way (form me) but I also updated the code, works fine, thank you. So here it is, see attachement.
Tobias
User e59cb00a69
26-12-2007 10:42:30
Hello there,
This topic seems to be the close enough to my query. I have to send an email to a superior who does not have instant jchem nor want to install it. Intuitively he asks for a pdf, and I naively thought I could just chose my default print to pdf option that is available on my mac. There is a print to file option, but for some reason this results in a ps (post script) file being sent to my printer rather than to file in the location I specified.
Does anyone have solutions? I would like an exact representation of the grid view.
Thanks for your help
ChemAxon 7c2d26e5cf
02-01-2008 14:09:21
It seems to be an InstantJChem issue. By printing MarvinView tables, there are "Preview" and "PDF" options (beside the "Print" button) on the Print panel.
(To tell the truth, your question is not too close to the original topic. InstantJChem uses a totally different renderer for tables than Marvin.)
I forward your questions to the IJC team.
ChemAxon fa971619eb
02-01-2008 15:31:50
We will look at the print to file and/or PDF situation in Instant JChem.
But without that working I don't think there are any options for getting an exact representation of what you see in IJC. You could of course export the data to a SD file or similar, but would require the recipient of the file being able to view it.
User 0caa0c681f
14-05-2009 10:21:17
TobiasKind wrote: |
Hi Tamas, once you know its easy :-) I did it the easy way (form me) but I also updated the code, works fine, thank you. So here it is, see attachement. Tobias |
How to convert skc file or TGF file to sdf file or RXn file
ChemAxon 990acf0dec
14-05-2009 13:24:29
Hi,
Presently the SKC import feature is not available in Marvin; it is planned for version 5.3 coming this Autumn.
Best regards,
Akos
User e34a92cce5
13-01-2013 07:34:02
I tried to use sdf2mol according to Tobias instruction and get this error:
Number of molecules in C:\Compounds.sdf: 15
Exception in thread "main" java.lang.NoSuchMethodError: chemaxon.formats.MolExporter.write(Lchemaxon/struc/Molecule;)V
at examples.sdf2mol.main(sdf2mol.java:190)
I am using JChem 5.5
ChemAxon 5433b8e56b
14-01-2013 12:07:38
Hi,
it is better to simply use the molconvert tool from command line like this:
molconvert mol inputfile.sdf -o outpufilename.mol -m
Is this suitable for you, or you need a Java solution?
Regards,
Istvan