Skip to content

Move self-test for Bio.PDB.PSEA - #1336

Open
souravsingh wants to merge 5 commits into
biopython:masterfrom
souravsingh:add-selftest
Open

souravsingh wants to merge 5 commits into
biopython:masterfrom
souravsingh:add-selftest

Conversation

@souravsingh

Copy link
Copy Markdown
Contributor

Fixes a part of #820

@souravsingh

Copy link
Copy Markdown
Contributor Author

@peterjc The test is throwing an error due to file mismatch.

@peterjc

peterjc commented Jul 22, 2017

Copy link
Copy Markdown
Member

e.g.

======================================================================
ERROR: test_psea (test_PDB.PSEATests)
Self-test for PSEA
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\biopython\Tests\test_PDB.py", line 1489, in test_psea
    self.assertEqual(PSEA.PSEA(s[0], pdb1))
  File "C:\projects\biopython\Bio\PDB\PSEA.py", line 90, in __init__
    ss_seq = psea(filename)
  File "C:\projects\biopython\Bio\PDB\PSEA.py", line 44, in psea
    with open(fname, 'r') as fp:
IOError: [Errno 2] No such file or directory: '1A8O.sea'
----------------------------------------------------------------------
Ran 274 tests in 662.104 seconds

Where does the 1A8O.sea come from?

@souravsingh

souravsingh commented Jul 22, 2017 •

Copy link
Copy Markdown
Contributor Author

The self-test takes sys.argv[1] as an input for the file, which I believed that it is a PDB file. I could be mistaken about it.

@peterjc

peterjc commented Jul 22, 2017

Copy link
Copy Markdown
Member

Right, but you need the psea binary present to generate the output. So you may need to add this as a run time check (like many of the other tests verify a tool is installed).

Also, if you run this locally and check in the file, we can test the parser side of things even without the binary?

@souravsingh

Copy link
Copy Markdown
Contributor Author

For checking the psea binary. do we have to add a check which looks somthing like this?- https://github.com/biopython/biopython/blob/master/Tests/test_NACCESS_tool.py#L20

@peterjc

peterjc commented Jul 22, 2017

Copy link
Copy Markdown
Member

@souravsingh

Copy link
Copy Markdown
Contributor Author

@peterjc I found the .sea file along with the psea tarball. Would it be possible to make use of the file for testing?

@peterjc

peterjc commented Jul 26, 2017

Copy link
Copy Markdown
Member

Overall this is looking better. There are some style issues to address:

$ flake8 Tests/
Tests/test_PDB_PSEA.py:10:1: E999 SyntaxError: can't assign to operator
Tests/test_PDB_PSEA.py:10:2: E226 missing whitespace around arithmetic operator
Tests/test_PDB_PSEA.py:15:10: E226 missing whitespace around arithmetic operator
Tests/test_PDB_PSEA.py:32:1: W293 blank line contains whitespace
Tests/test_PDB_PSEA.py:33:1: E305 expected 2 blank lines after class or function definition, found 1

@peterjc

peterjc commented Jul 26, 2017

Copy link
Copy Markdown
Member

It looks like we could download and compile p-sea on TravisCI, perhaps something like this - note that unusually the tar-ball does not use a sub-folder:

mkdir -p /tmp/p-sea
cd /tmp/p-sea
wget ftp://ftp.lmcp.jussieu.fr/pub/sincris/software/protein/p-sea/P-SEA.tar.gz
tar -zxvf P-SEA.tar.gz
cc p-sea.c -o p-sea
mv p-sea $HOME/bin
$ ./p-sea -h
o-----------------------------------------------o
|                                               |
| p-sea :   Version 0.99 LMCP       Sept   96   |
|                                               |
o-----------------------------------------------o
| synopsis : phi psi omega alpha tau chi(s)     |
| and CA-1 CA+1 distance computing              |
|                                               |
| usage: sea pdb_file [out.sea]                 |
|                                               |
| ' ' : assign secondary structure              |
|                                               |
o-----------------------------------------------o
| options:                                      |
| -p  : computes phi, psi and omega             |
| -a  : computes alpha,tau and CA_CA+1 distance |
| -x  : computes chi1,chi2 and chi3             |
| -d  : computes CA-1_CA+1 distance             |
| -h  : displays this help                      |
| -m  : assign secondary structure              |
o-----------------------------------------------o
| if for any reason (missing atoms, angle not   |
| defined,...) the angle cannot be computed,    |
| it is set to 500.0                            |
|                                               |
o-----------------------------------------------o
| output              : on standard output      |
| comments and errors : on standard error       |
|                                               |
o-----------------------------------------------o
|                                               |
| The ouput values are in order (on one line):  |
| Atom_name Residue_name Residue_number [Phi \ |
| Psi Omega] [Alpha Tau CA_CA+1_Distance]    \ |
| [Chi1 Chi2 Chi3] [CA-1_CA+1_Distance]         |
|                                               |
o-----------------------------------------------o

I wonder however since p-sea has not been updated since September 1996 if we should deprecate the module...

@souravsingh

souravsingh commented Jul 26, 2017 •

Copy link
Copy Markdown
Contributor Author

@peterjc Should we discuss deprecation of PSEA module at the mailing list?

I am not sure if anyone uses the module.

@peterjc

peterjc commented Jul 26, 2017

Copy link
Copy Markdown
Member

Yes, please bring the possible deprecation up on the mailing list.

Comment thread Tests/test_PDB_PSEA.py Outdated

os.environ['LANG'] = 'C'

p-sea = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot use a minus-sign/hyphen as part of a Python variable name. How about psea or p_sea here?

Comment thread Tests/test_PDB_PSEA.py Outdated
except OSError:
pass

if not clustalo_exe:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be testing if the p-sea tool was found (see comment about what to use as the variable name).

Comment thread Tests/test_PDB_PSEA.py
pass

if not clustalo_exe:
raise MissingExternalDependencyError(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have not imported this exception, you need to include:

from Bio import MissingExternalDependencyError

@souravsingh

Copy link
Copy Markdown
Contributor Author

@peterjc Should we wait for @JoaoRodrigues reply on deprecating PSEA module before proceeding with this?

@peterjc

peterjc commented Aug 23, 2017

Copy link
Copy Markdown
Member

True. If we are going to deprecate the PSEA module, there is less reason to bother with this testing work.

@souravsingh

souravsingh commented Sep 5, 2017 •

Copy link
Copy Markdown
Contributor Author

@peterjc Is this good to merge, since we have confirmed p-sea works for Linux?

@peterjc

peterjc commented Sep 5, 2017

Copy link
Copy Markdown
Member

The tests are failing so its not ready to merge,

======================================================================
ERROR: test_psea (test_PDB.PSEATests)
Self-test for PSEA
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/biopython/biopython/Tests/test_PDB.py", line 1557, in test_psea
    self.assertEqual(PSEA.PSEA(s[0], pdb1))
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-3.4/Bio/PDB/PSEA.py", line 90, in __init__
    ss_seq = psea(filename)
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-3.4/Bio/PDB/PSEA.py", line 44, in psea
    with open(fname, 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '1A8O.sea'
----------------------------------------------------------------------

Are you interested in setting up a BioConda package for P-SEA?

There isn't a Debian package so we can't use that on TravisCI, but we could perhaps try adding installing P-SEA to our .travis.yml file? (Provided it does not add much to the build time).

@souravsingh

Copy link
Copy Markdown
Contributor Author

@peterjc I can help setup a Bioconda package for p-sea. It would take a few minutes to create a PR.

@souravsingh souravsingh mentioned this pull request Sep 5, 2017
3 of 5 tasks
@peterjc

peterjc commented Sep 7, 2017

Copy link
Copy Markdown
Member

See #1384, we decided not to deprecate the P-SEA code.

See also bioconda/bioconda-recipes#5948 for getting P-SEA into BioConda

@valentin994

valentin994 commented Jun 1, 2022 •

Copy link
Copy Markdown
Contributor

Hey, I started working on this issue but the p-sea tool won't compile on my machine. Couldn't find documentation for it, so I would be grateful if someone could point/help me out here.

p-sea.c:193:16: error: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Werror,-Wimplicit-function-declaration]
        ResAtom *ra = NEW(ResAtom);
                      ^
p-sea.c:128:26: note: expanded from macro 'NEW'
#define NEW(obj)                (obj *)malloc(sizeof(obj))
                                       ^
p-sea.c:193:16: note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
p-sea.c:128:26: note: expanded from macro 'NEW'
#define NEW(obj)                (obj *)malloc(sizeof(obj))
                                       ^
p-sea.c:205:12: error: implicit declaration of function 'get_distca_1_5' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           get_distca_1_5(res); /* contient get_distca_1_3() et get_distca_1_4()*/
           ^
p-sea.c:265:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main(int argc, char **argv)
^
p-sea.c:285:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
        exit(0);
        ^
p-sea.c:285:2: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
p-sea.c:562:3: error: implicit declaration of function 'free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                free(res);
                ^
p-sea.c:1605:8: warning: address of stack memory associated with local variable 'ra' returned [-Wreturn-stack-address]
return ra;
       ^~
2 warnings and 4 errors generated.

@peterjc

peterjc commented Jun 14, 2022

Copy link
Copy Markdown
Member

See #1384 (comment) about adding an include for stdlib.h etc.

@valentin994

Copy link
Copy Markdown
Contributor

Hm that didn't work as well for me, I'm on an intel based mac. people mention it works for them, kinda weird.

@JoaoRodrigues

Copy link
Copy Markdown
Member

You need to declare the get_distance_1_5 function in the header file as well, i.e. add int get_distca_1_5( Residu *r); to the header somewhere. Then it compiles on my intel-based mac (with a few warnings).

@valentin994 valentin994 mentioned this pull request Jul 11, 2022
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants