Skip to main content

perseuspy README

Documentation Status https://travis-ci.org/cox-labs/perseuspy.svg?branch=master

This repository contains the source code of the perseuspy software package. perseuspy contains convenience functions which allow for faster and easier development of plugins for Perseus in the Python programming language. This page contains installation instructions and developer information on perseuspy, for high-level information please refer to the manuscript listed below.

perseuspy was designed to work in conjunction with the PluginInterop plugin, but can also be used stand-alone.

Citation

If you use perseuspy in your projects, please cite

Rudolph, J D and Cox, J 2018, A network module for the Perseus software for computational proteomics facilitates proteome interaction graph analysis doi:10.1101/447268.

Installation

perseuspy can be installed directly from pip. If you are new to Python, more detailed installation instructions for windows are provided below.

pip install perseuspy

Developing plugins

Perseus provides activities to call Python scripts from within the workflow via PluginInterop, e.g. Matrix => Python. Developing a plugin therefore translates to writing a Python script that follows a small set of conventions. By adhering to these conventions, Perseus will be able to successfully communicate with R and transfer inputs and results between the programs. perseuspy provides the neccessary functions to make plugin development in Python easy and straight forward.

Matrix plugin

This example Python script extracts the first 15 rows from the matrix. While its functionality is very simple. It can serve as a starting point for more extensive scripts.

import sys
from perseuspy import pd
from perseuspy.parameters import *
_, infile, outfile = sys.argv # read arguments from the command line
df = pd.read_perseus(infile) # read the input matrix into a pandas.DataFrame
df2 = df.head(15) # keep only the first 15 rows of the table
df2.to_perseus(outfile) # write pandas.DataFrame in Perseus txt format

Network plugin

The following snippet can be used as a starting point for network analyses.

import sys
from perseuspy import nx, pd, read_networks, write_networks
_, infolder, outfolder = sys.argv # read arguments from the command line
networks_table, networks = read_networks(infolder) # networks in tabular form
graphs = nx.from_perseus(networks_table, networks) # graphs as networkx objects
# perform some analysis
_networks_table, _networks = nx.to_perseus(graphs) # convert back into tabular form
write_networks(tmp_dir, networks_table, networks) # write to folder

Updating to the latest version

pip install --upgrade perseuspy

Installation (Windows long)

First open a terminal by searching for cmd.exe in the start menu. Here we can easily check if all required programs are installed.

  1. Check to see if the pip executable is already available.

    pip install perseuspy

    If there is no error you are already done. If it fails, continue with the next steps.

  2. Navigate to the installation directory of your Python installation. If it is installed e.g. D:/Programs/Python/ we would first change the drive letter (maybe unnecessary) and then go to the installation directory.

    D:
    cd Programs/Python

    Now we should be able to run python from the command line.

    python.exe --version

    This should print the installed version of python

  3. Navigate to the Scripts directory and run the installation

    cd Scripts
    pip install perseuspy

    If you want to upgrade you installation, run

    pip install --upgrade perseuspy
  4. Test the installation by navigating back to the Python folder and trying to import perseuspy.

    cd ..
    python.exe

    Now you should be inside the python interpreter. Check the installation by running.

    import perseuspy

    If the command doesn’t produce any error you can exit python by pressing CTRL+c.

  5. Add python to your PATH (optional, recommended). Makes it easier for Perseus to find the Python installation. There are many resources on how to add programs to the PATH available online. No description is provided here since instructions are specific to the version of Windows that is used.

Usage

You can use perseuspy just like any other python module.

# import a monkey-patched version of pandas
from perseuspy import pd
df = pd.read_perseus('matrix1.txt')
df2 = df.dropna()
df2.to_perseus('matrix2.txt')

Generating the developer documentation

Run ./generate_docs.sh from bash.

Licensing and Contributions

perseuspy is licensed under the MIT lisence. Contributions are welcome! If you are interested in contributing to code or documentation, please read CONTRIBUTING.rst.

Metadata

Release files for perseuspy 0.3.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perseuspy 0.3.9
File Size Uploaded
perseuspy-0.3.9.linux-x86_64.tar.gz 27.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perseuspy 0.3.9
File Interpreter ABI Platform
perseuspy-0.3.9-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / perseuspy-0.3.9.linux-x86_64.tar.gz

Download URL perseuspy-0.3.9.linux-x86_64.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bf91fde6f517bbec024d31ffe241d5bae9055742847bbac9ecaf67524072fb3f
BLAKE2b-256 checksum
How to use checksums
ef08d06a48ecaad76657df941f1f616fcbc37e8526e4c08092fe3ce3b1b09c05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.2

Release files / perseuspy-0.3.9-py3-none-any.whl

Download URL perseuspy-0.3.9-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8929f196aa864fad2997d17d139f560a7ab8418c3c5ba11d74d3cee3df1e18b8
BLAKE2b-256 checksum
How to use checksums
cf66e2c5737567b6e7c369d1d75e2ba2fa03243e4dcea3fb46a31353fa734d7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.2

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files

0.3.8

2 release files

0.3.7

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page