Re: Problem of Calling OB with PHP (Jie Shen)

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

Re: Problem of Calling OB with PHP (Jie Shen)

lirong wang
Maybe you can try like this
$CMD ='/usr/local/bin/python /home/monkey/Monkey0.01/selected.py -p
'.$_POST['types'].' -s -1'.' -l'. $_POST['classlabel'].' -i
'.$uploadfile_train.' -o '.$ig_anal_out.'2>&1';
echo `$CMD`;

lirong
-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Thursday, September 09, 2010 11:11 AM
To: [hidden email]
Subject: OpenBabel-discuss Digest, Vol 52, Issue 3

Send OpenBabel-discuss mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of OpenBabel-discuss digest..."


Today's Topics:

   1. Problem of Calling OB with PHP (Jie Shen)
   2. Re: Release candidates available for testing (Chris Morley)
   3. Re: Release candidates available for testing (Douglas Houston)
   4. Re: Release candidates available for testing (Craig A. James)
   5. Re: protonation and structure normalization (david.lagorce)
   6. inchi/inchikey and WriteString (Bradley Worley)


----------------------------------------------------------------------

Message: 1
Date: Tue, 7 Sep 2010 07:09:04 +0800
From: Jie Shen <[hidden email]>
Subject: [Open Babel] Problem of Calling OB with PHP
To: [hidden email]
Message-ID:
        <AANLkTim8WcbnU=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Dear all,

I am now trying to built a web-based calculation server. It will work like
this:

Using PHP call the python script in linux.

The script could run well in the terminal of linux, but the same
commands can not run successfully under PHP calling (using
"shell_exec")

The error listed:

Traceback (most recent call last):
?File "/home/monkey/Monkey0.01/selected.py", line 137, in
? main(sys.argv[1:])
?File "/home/monkey/Monkey0.01/selected.py", line 74, in main
? import getopt, string, readsdf
?File "/home/monkey/Monkey0.01/readsdf.py", line 33, in
? import pybel as pb
?File "/home/monkey/program/OB-2.2.3/lib/python2.6/site-packages/pybel.py",
line 16, in
? import openbabel as ob
?File
"/home/monkey/program/OB-2.2.3/lib/python2.6/site-packages/openbabel.py",
line 36, in
? _openbabel = swig_import_helper()
?File
"/home/monkey/program/OB-2.2.3/lib/python2.6/site-packages/openbabel.py",
line 35, in swig_import_helper
? return _mod
UnboundLocalError: local variable '_mod' referenced before assignment


The calling line in PHP is: (attached is the php file)

$results=shell_exec('/usr/local/bin/python
/home/monkey/Monkey0.01/selected.py -p '.$_POST['types'].' -s -1'.' -l
'.$_POST['classlabel'].' -i '.$uploadfile_train.' -o '.$ig_anal_out.'
2>&1');



BTW, this command can run successfully in the terminal after translation.
and we have exclude following reasons:
1. safe mode is already off
2. The shell command is right
3. there is no problem with "permission" issues.


I am grateful if anyone can help me.

Best regards,

Sincerely,

Jie Shen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: upload_basic.php
Type: application/octet-stream
Size: 5231 bytes
Desc: not available

------------------------------

Message: 2
Date: Wed, 08 Sep 2010 16:50:13 +0100
From: Chris Morley <[hidden email]>
Subject: Re: [Open Babel] Release candidates available for testing
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 08/09/2010 13:17, Douglas Houston wrote:
> Hi,
>
> According to this page:
>
>
http://baoilleach.webfactional.com/site_media/ob-docs/Features/Fingerprints.
html#fingerprints
>
> I can use the -s option with the name of a file, e.g.:
>
> babel mymols.sdf -sSubstructure.sdf mymols_filtered.sdf
>
> will write out all the compounds in mymols.sdf that contain the group
> in Substructure.sdf. However, what I'd like is the opposite, i.e. to
> write out everything that doesn't match. I tried using -v instead of
> -s but this didn't work.

I think the following will do what you want
babel mymols.sdf -s ~Substructure.sdf mymols_filtered.sdf
>
> It would also be nice if I could use a file that contained more than
> one entry, i.e. the file Substructure.sdf could define multiple
> fragments that I don't want  in my molecules, rather than having to
> run Babel on each one separately.

It would have to be decided whether the combination was AND or OR.
What you want is NOT(frag1 OR frag2 OR...)
In the related --filter option there is an implicit AND between tests,
but I think for both the -s filter and its inverse the OR behaviour is
more intuitive.
>
> Would this be doable before the final release?

It may be, but I am about to go on holiday, so don't hold your breath.

Thanks for this suggestion. Other suggestions for useful features are
very welcome.

You could look at the Sieve program, http://www.silicos.be/sieve.html 
which is an industrial-strength filtering program, now using OpenBabel.

Chris



------------------------------

Message: 3
Date: Wed, 08 Sep 2010 17:32:19 +0100
From: Douglas Houston <[hidden email]>
Subject: Re: [Open Babel] Release candidates available for testing
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes";
        format="flowed"

Thanks Chris,

The line you gave seemed to do the trick - after I escaped out the  
tilde. Is the usage of the tilde to reverse the sense of the filter  
documented? I would have thought the -v option would be logical.

Sieve seems to do what I want - almost. It looks like it filters using  
SMARTS - but all my undesirable groups are in SDF format. How do I  
convert to SMARTS? OpenBabel doesn't seem to do it (although it can  
filter using them, strangely).

I realise I could potentially use SMILES as input but this doesn't  
work in some cases, e.g. 'C1=CC=CC=C1' is a benzene ring in SMILES  
format but according to the following link will not match benzene if  
it's used as a SMARTS string.

http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html

cheers,

Doug



Quoting Chris Morley <[hidden email]>:

> On 08/09/2010 13:17, Douglas Houston wrote:
>> Hi,
>>
>> According to this page:
>>
>>
http://baoilleach.webfactional.com/site_media/ob-docs/Features/Fingerprints.
html#fingerprints

>>
>> I can use the -s option with the name of a file, e.g.:
>>
>> babel mymols.sdf -sSubstructure.sdf mymols_filtered.sdf
>>
>> will write out all the compounds in mymols.sdf that contain the group
>> in Substructure.sdf. However, what I'd like is the opposite, i.e. to
>> write out everything that doesn't match. I tried using -v instead of
>> -s but this didn't work.
>
> I think the following will do what you want
> babel mymols.sdf -s ~Substructure.sdf mymols_filtered.sdf
>>
>> It would also be nice if I could use a file that contained more than
>> one entry, i.e. the file Substructure.sdf could define multiple
>> fragments that I don't want  in my molecules, rather than having to
>> run Babel on each one separately.
>
> It would have to be decided whether the combination was AND or OR.
> What you want is NOT(frag1 OR frag2 OR...)
> In the related --filter option there is an implicit AND between tests,
> but I think for both the -s filter and its inverse the OR behaviour is
> more intuitive.
>>
>> Would this be doable before the final release?
>
> It may be, but I am about to go on holiday, so don't hold your breath.
>
> Thanks for this suggestion. Other suggestions for useful features are
> very welcome.
>
> You could look at the Sieve program, http://www.silicos.be/sieve.html
> which is an industrial-strength filtering program, now using OpenBabel.
>
> Chris
>
>
----------------------------------------------------------------------------
--

> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>




_____________________________________________________
Dr. Douglas R. Houston
Scientific Programme Coordinator / Research Associate
Room 3.23
Institute of Structural and Molecular Biology
Michael Swann Building
King's Buildings
University of Edinburgh
Edinburgh, EH9 3JR, UK
Tel. 0131 650 7358

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.





------------------------------

Message: 4
Date: Wed, 08 Sep 2010 10:05:42 -0700
From: "Craig A. James" <[hidden email]>
Subject: Re: [Open Babel] Release candidates available for testing
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 9/8/10 9:32 AM, Douglas Houston wrote:

> I realise I could potentially use SMILES as input but this doesn't
> work in some cases, e.g. 'C1=CC=CC=C1' is a benzene ring in SMILES
> format but according to the following link will not match benzene if
> it's used as a SMARTS string.
>
> http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html

If you canonicalize a SMILES (babel ... -o can), it usually works correctly
as a SMARTS.  That's one of the features of the canonical algorithm.  In the
case you cite, it would convert to "c1ccccc1", which is the SMARTS that you
want.

Craig



------------------------------

Message: 5
Date: Thu, 9 Sep 2010 02:44:39 -0700 (PDT)
From: "david.lagorce" <[hidden email]>
Subject: Re: [Open Babel] protonation and structure normalization
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=us-ascii


> openbabel command line, it would seem that the results are different
> from those obtained with the AddHydrogens() method embedded in the pybel
> library, with the correctforpH option.

>Well yes, if you're comparing AddHydrogens() with and without correctForPH,
then the results are >different. But I can assure you that Pybel calls the
same calls as the command-line when you supply >the same options.

> Does pybel use also the /data/phmodel.txt file?

> Yes.



ok, thanks a lot





> It is documented that it is possible to convert [N+]([O-])=O to N(=O)=O,
> but it doesn't work for the other representations of the nitro groups,
> like [N](-OH)=O.

>I have never seen a nitro group represented with an explicit H. Can you
give us a real example? Or a >list of the "other representations of nitro
groups" that you expect?



I am also agree with you, a nitro with an explicit H, by definition is not a
cleary possible, but you can sometimes find it in some databases....Thus,
how to correclty re-write it....with babel? In the same way, a nitro group
as N(=O)=O loaded in pybel is converted internaly in background to
N(OH)OH....
N(=O)=O is possible, so pybel will found 2 H-Bond Donors (lipinski
definition) but in fact there is no one...







> To this end, which file (containing the SMARTS patterns) is employed in
> the pybel method?

>CorrectDativeBonds does not use SMARTS patterns. Instead, it looks for atom
pairs with neighboring "+" and "-" formal charges and it increases the bond
order to remove the formal charges.

>Hope that helps,
>-Geoff

Thanks a lot for your help...

David
--
View this message in context:
http://open-babel.957263.n4.nabble.com/protonation-and-structure-normalizati
on-tp2528314p2532557.html
Sent from the openbabel-discuss mailing list archive at Nabble.com.



------------------------------

Message: 6
Date: Wed, 8 Sep 2010 13:48:36 -0500
From: Bradley Worley <[hidden email]>
Subject: [Open Babel] inchi/inchikey and WriteString
To: <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain

hi all,

i have a segment of C++ code that loads a "mol" file and tries to write
two strings: an inchi string and an inchikey string. the inchi
conversion works, but the inchikey WriteString() command that
immediately follows gives the inchi string, not the inchikey. (yes, i'm
using SetOptions("K",conv.OUTOPTIONS)).

am i missing something?

thanks,
~ brad worley.




------------------------------

----------------------------------------------------------------------------
--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd

------------------------------

_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


End of OpenBabel-discuss Digest, Vol 52, Issue 3
************************************************


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss