Skip to main content

Automated submission to the PSIPRED protein secondary structure calculator REST API.

Project description

PSIPREDauto Readme

PSIPREDauto simplifies and automates the use of the PSIPRED REST API. PSIPRED is a program to predict the secondary structure of proteins, available as an interactive web app, a REST API and source code on GitHub. All versions of PSIPRED were developed and are maintained by the UCL Department of Computer Science: Bioinformatics Group. This is an unnoffical package and is not affiliated with the PSIPRED team or UCL. If you use PSIPREDauto in any published work, please cite PSIPRED (see guidance from the PSIPRED team on how they like to be cited) and not this package, the PSIPRED team deserve the credit! Any acknowledgement of PSIPREDauto would of course be greatly appreciated, but this package would be impossible without the hard work of the PSIPRED team.

This package was developed as the documentation for both the PSIPRED REST API and source code is out of date and difficult to use, and only individual jobs can be submitted via the web app. Consequently using PSIPRED for any more than a handful of jobs is currently difficult. The aim of PSIPREDauto is to allow easy submission of large jobs to PSIPRED and to automatically retrieve the results. This is all done with minimal effort for the user via Python.

After installation PSIPREDauto can be used either as a python package in your IDE, or from the command line via the commandline.py script. PSIPREDauto has only been tested on Windows 10, however only makes use of the Python standard library and the widely compatible progressbar2 library so should work on any OS.

Installation

PSIPREDauto is available from PyPI using pip:

pip install PSIPREDauto

Alternatively, the source code is available on github to do with what you will.

Examples

Before use ensure that the file/s you wish to upload are appropriate! All files must be .fasta files containing a single protein sequence. Files containing multiple sequences are currently not supported, although functionality to automatically split them is planned. Individual files or batch jobs can be submitted.

In python

To submit an individual file from python call the single_submit function. single_submit requires you to specify the full path to the input file, an email address and an output directory where results will be saved. For example, to submit the file "TestSeq.fasta" in the directory "C:\Sequences" with the email address foo@bar.com, and save the results in "C:\Sequences\Results" you would use the following call:

from PSIPREDauto.functions import single_submit

single_submit(r"C:\Sequences\TestSeq.fasta", "foo@bar.com", r"C:\Sequences\Results")

Note that the file paths are passed as strings! Currently no other types of submission are supported.

For each submission PSIPRED returns 7 different results files in various formats which will be saved in the folder "C:\Sequences\Results\TestSeq.fasta output". Note the PSIPRED server will also send a copy of the results to the specified email address. There is also an optional parameter 'interval' to alter how often the server is polled for results. For example:

single_submit(r"C:\Sequences\TestSeq.fasta", "foo@bar.com", r"C:\Sequences\Results", interval=1)

would poll the server for results after 1 minute rather than the default 4 minutes. Note that the PSIPRED team recommend 2-5 minutes, however for individual files smaller values are generally ok.

To submit a batch of files use the batch_submit function. batch_submit requires you to specify the path of the folder containing the .fasta files (batch_submit will submit all .fasta files in the folder), an email address and an output directory where results will be saved. For example to submit all .fasta files in "C:\Sequences" and save the results in "C:\Sequences\Results" you would use the following call:

from PSIPREDauto.functions import batch_submit

batch_submit(r"C:\Sequences", "foo@bar.com", r"C:\Sequences\Results")

The results will be saved in the folder "C:\Sequences\Results\Output ", where the timestamp is in dd-mm-yy h-m-s format. Remember that you will also receive a seperate email copy of the results for each file submitted, if you are submitting a large batch it is advisable to set up an email filter to prevent your inbox being flooded by PSIPRED (emails will be from "psipred@cs.ucl.ac.uk", without quotes) . batch_submit also has the 'interval' parameter which behaves in the same way as in single_submit. It is recommended to not alter this in most cases as setting lower values can lead to instability. For small batches of short sequences lower values may lead to faster completion, however for longer sequences and larger batches it may cause the program to crash before completion. This is because if too many requests are made before jobs are complete the server will start rejecting requests, causing an exception to be thrown. At present this will cause a crash.

From the command line

Single and batch submissions can be made from the command line through "commandline.py". Parameters are largely the same as in python but you must specify if you are submitting a single or batch job with the --single or --batch keywords rather than by calling a different function. Use the following example to display the command line help information.

python -m PSIPREDauto.commandline --help

To submit "TestSeq.fasta" in the directory "C:\Sequences" and save the results in "C:\Sequences\Results" you would use the following:

python -m PSIPREDauto.commandline --single --input "C:\Sequences\TestSeq.fasta" --email "foo@bar.com" --output "C:\Sequences\Results"

Submitting a batch job is similar, but the --batch keyword must be used instead of --single. For example to submit all .fasta files in "C:\Sequences" and save the results in "C:\Sequences\Results\Output " you would use the following:

python -m PSIPREDauto.commandline --batch --input "C:\Sequences" --email "foo@bar.com" --output "C:\Sequences\Results"

There is also an --interval keyword argument that works in the same way as above, however only takes integer values. As when used in a Python script the default interval is 4 minutes.

Other things to note

  • Remember that all file paths must be provided as a string! Alternatives such as the path without quotes or pathlib.Path objects will result in an exception.
  • The progress bar will only update after it successfully receives results from the server (default every 4 minutes), lack of movement on the progress bar does not mean nothing is happening. Additionally the progress bar isn't particlarly accurate for small batches as it doesn't take into account the waiting interval.

Logging

PSIPREDauto uses the python logging module. Enable logging to see more information about what is going on behind the scenes.

Known issues

  • Very large batches (~>1000 sequences) are currently prone to failure due to the server eventually rejecting a request even if the time interval is long. Possibly due to high load from other users? Working on a feature to catch this exception and prevent the crash here.
  • Very large batches also seem to sometimes experience a problem where progress stops without an exception being thrown. Currently unsure what is causing this issue but it is suspected to be due to the modules internal job queue filling up with jobs that cannot have their results retrieved.
  • Losing internet connection during a job will result in a crash.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PSIPREDauto-0.0.1.1.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PSIPREDauto-0.0.1.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file PSIPREDauto-0.0.1.1.1.tar.gz.

File metadata

  • Download URL: PSIPREDauto-0.0.1.1.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.10

File hashes

Hashes for PSIPREDauto-0.0.1.1.1.tar.gz
Algorithm Hash digest
SHA256 ade2576d53095662c677df10eafbb203bbf4de4da2d0d3480c6848f7e9808241
MD5 872844a57f614ca25b4542d3230585f0
BLAKE2b-256 1a8c3b433db7903fb91b63e5d48b8978f3c75ea8a67b95b6b724f3fa9fb2bd02

See more details on using hashes here.

File details

Details for the file PSIPREDauto-0.0.1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for PSIPREDauto-0.0.1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45f0cb17df948862c4f4e44ee780ddb01739b79f0a8e50cc3b3220227fe641f7
MD5 c69ef1c09ef5d91e29e7942e642f2f5f
BLAKE2b-256 828a4ff3d99ee268ff1e5b6b2e39607744c1da51810eb7ecbaafcf9bfb2e1f9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page