Hi Wallace, I'm not much good with Perl, but for those folks who are, could you provide a complete Perl script that reproduces the problem. The smaller the script the better. For example, at the moment I can easily blame everything on what everything is in @sdfdata. Also please note that ReadFile returns a boolean that indicates whether it was successful or not. A common cause of problems is that the user does not check whether there was a problem before proceeding.
- Noel On 22 November 2013 20:54, Wallace Chan <walla...@umich.edu> wrote: > Dear All, > > Once again, I apologize for my utter lack of experience, but I was hoping > y'all could help me out with a problem I've been having. Using OpenBabel in > Perl, I have been trying to convert several 2D SDF files to 3D. The process > appears to be stuck somewhere between the 'Do' and 'WriteFile' functions, > shown as follows in bold: > > my $filename = $id . '.sdf'; > open (OUT, ">temp.sdf"); > print OUT @sdfdata; > close OUT; > $obConversion->ReadFile($obMol, "temp.sdf"); > $genOp->Do($obMol); > $obConversion->WriteFile($obMol, $filename); > print "Generated $filename.\n"; > `rm temp.sdf`; > last; > > The reason I came to this conclusion was that the file, $filename, was never > generated, while temp.sdf was. I also have the following initialized outside > before my loop: > > my $obMol = Chemistry::OpenBabel::OBMol->new(); > my $obConversion = Chemistry::OpenBabel::OBConversion->new(); > my $genOp = Chemistry::OpenBabel::OBOp::FindType("gen3D"); > $obConversion->SetInAndOutFormats("sdf", "sdf"); > > Here are some of the reasons why I think it doesn't work: > 1.) It isn't possible to convert 2D SDF to 3D SDF > 2.) I was successful using this converting InChI to 3D SDF, but maybe I need > to call a different class > > Thanks in advance for any advice! > > -- > Wallace Chan > Zhang Lab > Department of Biological Chemistry > University of Michigan > walla...@umich.edu > > ------------------------------------------------------------------------------ > Shape the Mobile Experience: Free Subscription > Software experts and developers: Be at the forefront of tech innovation. > Intel(R) Software Adrenaline delivers strategic insight and game-changing > conversations that shape the rapidly evolving mobile landscape. Sign up now. > http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss