From: kohai.raul <koh...@gm...> - 2011-01-25 18:22:27
|
Oops, pasted wrong version of perl script: >From PERL (OBConverter.pl): #!/usr/bin/perl use Chemistry::OpenBabel; $chemdata = shift; $serviceIn = shift; $serviceOut = shift; my $obMolIn = new Chemistry::OpenBabel::OBMol; my $obConv = new Chemistry::OpenBabel::OBConversion; $obConv->SetInAndOutFormats($serviceIn, $serviceOut); $obConv->ReadString($obMolIn, $chemdata); my $obOut=$obConv->WriteString($obMolIn); print ("$obOut"); 2011/1/25 kohai.raul [via Open Babel] < ml-...@n4...<ml-node%2B3...@n4...> > > Hi all, > > problem Solved! ... if it could to help someone: > > From PHP: > > > > public function largeDataConverter($chemData,$inFormat,$outFormat){ > > $file="OBConverter.pl @'$chemData' '$inFormat' '$outFormat'"; > $myVar = ""; > > ob_start(); > passthru("$file"); > $myVar = ob_get_contents(); > ob_end_clean (); > > if (substr_count(strtolower($myVar), 'error')>0) > $myVar=""; > > return $myVar; > > //$myVar contains the conversion result from perl script. > > } > > > > From PERL (OBConverter.pl): > > > #!/usr/bin/perl > > use Chemistry::OpenBabel; > > @chemdata = shift; > $serviceIn = shift; > $serviceOut = shift; > > my $obMolIn = new Chemistry::OpenBabel::OBMol; > my $obConv = new Chemistry::OpenBabel::OBConversion; > > $obConv->SetInAndOutFormats($serviceIn, $serviceOut); > $obConv->Read($obMolIn, @chemdata); > my $obOut=$obConv->WriteString($obMolIn); > > print ("$obOut"); > > > This way, Perl admits $chemdata as SMI or MOL, all in string format, no > external files needed. > > Thanks to this, I found that JME-SMI->MOL / or CML / or VMOL, etc.. have > not the same results as JME-MOL->CML / or VMOL, etc ... because to spatial > data??... maybe... as I said, I'm not chemist, but now I understand that > SMI doesn't express the same information such as MOL, and there will be more > resulting data in MOL->CML than SMI->CML > > Now, I can not only make use of JME.smiles() (from javascript), but > JME.molFile() and obtain via "php-ob-bridge" conversions to CML, VMOL, INCHI > .... through the flux: > > Web-Client (JME ->javascript molFile -> AJAX ) -> SERVER ( php + > "ob-bridge" -> chem results available on php -> to DB or anything ) -> > callback (JSON) -> javascript (on web client) > > Best Regards, > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://forums.openbabel.org/MOL-file-as-string-by-parameter-and-JME-tp3233189p3236634.html > To unsubscribe from MOL file as string by parameter and JME, click here<http://forums.openbabel.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3233189&code=a29oYWkucmF1bEBnbWFpbC5jb218MzIzMzE4OXwtMTg3MTk2NzAx>. > > -- -- Raúl Cruz foro.fuentedepermacultura.org "pro-curando..." -- View this message in context: http://forums.openbabel.org/MOL-file-as-string-by-parameter-and-JME-tp3233189p3236724.html Sent from the openbabel-scripting mailing list archive at Nabble.com. |