split a multiple-structure file in multiple single-structure file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

split a multiple-structure file in multiple single-structure file

oscar.rivera
Dear colleagues

Usually, calculation softwares demand chemical structures be uploaded  
in individual files (one molecule per file). I´d like to know if  
OpenBabel can export this way from a file containing all structures.

Thanks in advance for your kind help,

Oscar


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: split a multiple-structure file in multiple single-structure file

Craig James-2
Hi Oscar,

> Usually, calculation softwares demand chemical structures be uploaded  
> in individual files (one molecule per file). I´d like to know if  
> OpenBabel can export this way from a file containing all structures.

If you type "babel -H" (help), you'll find this:

-m Produces multiple output files, to allow:
   Splitting: e.g.        babel infile.mol new.smi -m
     puts each molecule into new1.smi new2.smi etc

Alternatively, if you are using SDF files, and you have access to Perl on a command line, I can send you a fairly simple Perl program that will split an SDF file into individual records.  It has the advantage that it doesn't alter the SDF records at all.

Craig

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: split a multiple-structure file in multiple single-structure file

Geoffrey Hutchison
In reply to this post by oscar.rivera
> OpenBabel can export this way from a file containing all structures.

Yes, usually. I could give you an example if you told me a bit more  
about the specifics of the formats involved. But let's take this for  
an example:

babel file.sdf -xk "#n B3LYP/6-31G* Opt" -ocom -m

That should split the SDF file into multiple Gaussian input files. You  
can also do something like this in UNIX:

for x in `seq 10 20`; do babel -f $x -l $x file.sdf -xk "#n B3LYP/
6-31G* Opt" file-$x.com

This will split out the molecules from 10-20 into separate files: file-10.com
  ... etc.

Hope that helps,
-Geoff

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss