Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

# 🔧 NEW: ensure modern packaging tools before installing anything
- name: Upgrade pip, setuptools, and wheel
run: |
python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest pytest-cov flake8

- name: Install package
run: pip install -e .

- name: Lint with flake8
run: |
# Fail on syntax errors or undefined names; treat everything else as a warning
flake8 pylipid --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 pylipid --count --exit-zero --max-line-length=120 --statistics

- name: Run tests
run: |
pytest tests/ -v --cov=pylipid --cov-report=term-missing

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: .coverage
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

152 changes: 111 additions & 41 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,65 +1,135 @@
PyLipID - Analysis of Protein–Lipid Interactions from Molecular Dynamics
============================================================

==========================================================
PyLipID - A Python Package For Lipid Interactions Analysis
==========================================================

.. image:: https://travis-ci.com/wlsong/PyLipID.svg?branch=master
:target: https://travis-ci.com/github/wlsong/PyLipID
.. image:: https://github.com/pstansfeld/PyLipID/actions/workflows/ci.yml/badge.svg
:target: https://github.com/pstansfeld/PyLipID/actions/workflows/ci.yml
.. image:: https://img.shields.io/pypi/v/PyLipID
:target: https://pypi.org/project/pylipid/
.. image:: https://img.shields.io/pypi/pyversions/PyLipID
:target: https://pypi.org/project/pylipid/

.. image:: docs/static/pylipid_logo_smallsize.png
:align: center
:align: center

PyLipID is a Python package for analysing lipid–protein interactions from
Molecular Dynamics (MD) simulations. It supports coarse-grained and all-atom
simulations, handles formats supported by MDTraj, and works in scripts or
Jupyter notebooks.

PyLipID is a python package for analyzing lipid interactions with membrane proteins from
Molecular Dynamics Simulations. PyLipID has the following main features, please check out
the tutorials for examples and the documentations for the API functionalities:
Documentation: https://pylipid.readthedocs.io

* Detection of binding sites via calculating community structures in the interactions networks.
* Calculation of lipid koff and residence time for interaction with binding sites and residues.
* Analysis of lipid interactions with binding sites and residues using a couple of metrics.
* Generation of representative bound poses for binding sites.
* Analysis of bound poses for binding sites via automated clustering scheme.
* Adoption of a dual-cutoff scheme to overcome the 'rattling in cage' effect of coarse-grained simulations.
* Generation of manuscript-ready figures for analysis.
Features
========

PyLipID can be used from Jupyter (former IPython, recommended), or by writing Python scripts.
The documentaion and tutorials can be found at `pylipid.readthedocs.io <https://pylipid.readthedocs.io>`_.
- Dual-cutoff contact detection to improve coarse-grained accuracy.
- Binding site detection using NetworkX Louvain community analysis.
- Kinetic parameters: koff and residence times per residue and site.
- Interaction metrics including occupancy, count, duration.
- Representative bound pose extraction and clustering.
- SASA calculations per residue and site.
- Publication-ready plots and PyMOL scripts.

Installation
============

We recommend installing PyLipID using the package installer `pip`:
From PyPI::

pip install pylipid

From source::

git clone https://github.com/pstansfeld/PyLipID
cd PyLipID
pip install .

Editable/development install::

pip install -e .

Requires Python >= 3.9.

``pip install pylipid``
Quick Start
===========

Alternatively, PyLipID can be installed from the source code. The package is available for
download on Github via:
.. code-block:: python

``git clone https://github.com/wlsong/PyLipID``
from pylipid.api import LipidInteraction

Once the source code is downloaded, enter the source code directory and install the package as follow:
trajfile_list = ["run1/protein_lipids.xtc", "run2/protein_lipids.xtc"]
topfile_list = ["run1/protein_lipids.gro", "run2/protein_lipids.gro"]

``python setup.py install``
li = LipidInteraction(
trajfile_list,
topfile_list=topfile_list,
cutoffs=[0.55, 0.8],
lipid="CHOL",
nprot=1,
)

li.collect_residue_contacts()
li.compute_residue_duration()
li.compute_residue_koff()
li.compute_binding_nodes(threshold=4)
li.compute_site_koff()

Citation |DOI for Citing PyEMMA|
================================
li.plot("Residence Time")
li.save_data("Dataset")
li.save_pymol_script(pdb_file="receptor.pdb")

If you use PyLipID in scientific research, please cite the following paper: ::
What's New in v1.6.0
====================

@article{song_pylipid_2022,
author = {Song, Wanling. and Corey, Robin A. and Ansell, T. Bertie. and
Cassidy, C. Keith. and Horrell, Michael R. and Duncan, Anna L.
and Stansfeld, Phillip J. and Sansom, Mark S.P.},
title = {PyLipID: A Python package for analysis of protein-lipid interactions from MD simulations},
journal = {J. Chem. Theory Comput},
year = {2022},
url = {https://doi.org/10.1021/acs.jctc.1c00708},
doi = {10.1021/acs.jctc.1c00708},
urldate = {2022-02-18},
}
Bug Fixes
---------
- Corrected binding-site detection off-by-one error.
- Fixed calculate_scores returning None.
- Fixed sparse_corrcoef matrix type issues.
- Fixed DataFrame column/index mismatches in analyze_bound_poses.
- Fixed missing return in compute_residue_lipidcount.
- Fixed write_PDB errors for .gro files lacking chain IDs.
- Fixed figure overwriting in plot_koff.
- Updated deprecated Matplotlib calls.
- Fixed LogNorm crash on zero-containing matrices.
- Replaced np.float128 with np.longdouble.
- Corrected output directory typo.

.. |DOI for Citing PyEMMA| image:: https://img.shields.io/badge/DOI-10.1021/acs.jctc.1c00708-blue
Performance
-----------
- collect_residue_contacts now calls md.compute_distances once per residue.
- Nested progress bars implemented.

Dependencies
------------
- Removed python-louvain; using NetworkX built-in Louvain.
- Minimum versions added.
- Dropped Python < 3.9.

Packaging & CI
--------------
- Migrated to pyproject.toml.
- CI moved from Travis CI to GitHub Actions.

Citation
========

.. image:: https://img.shields.io/badge/DOI-10.1021/acs.jctc.1c00708-blue
:target: https://doi.org/10.1021/acs.jctc.1c00708

::

@article{song_pylipid_2022,
author = {Song, Wanling and Corey, Robin A. and Ansell, T. Bertie and
Cassidy, C. Keith and Horrell, Michael R. and Duncan, Anna L.
and Stansfeld, Phillip J. and Sansom, Mark S.P.},
title = {PyLipID: A Python package for analysis of protein-lipid
interactions from MD simulations},
journal = {J. Chem. Theory Comput.},
year = {2022},
doi = {10.1021/acs.jctc.1c00708},
url = {https://doi.org/10.1021/acs.jctc.1c00708},
}

License
=======

MIT License. See LICENSE.txt.
22 changes: 22 additions & 0 deletions pylipid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,26 @@
# copies or substantial portions of the Software.
##############################################################################

# --- BEGIN: macOS-safe bootstrap -------------------------------------------
# Ensures PyLipID runs safely on macOS by:
# 1) forcing multiprocessing to use 'spawn'
# 2) preventing GUI backends from loading in worker processes
import multiprocessing as _mp

try:
# Safe on macOS — harmless on Linux/Windows
_mp.set_start_method("spawn", force=True)
except RuntimeError:
# Already set or protected — ignore
pass

# Use a non-interactive backend so importing PyLipID never loads macOS AppKit
try:
import matplotlib
matplotlib.use("Agg", force=True)
except Exception:
pass
# --- END: macOS-safe bootstrap ---------------------------------------------

from ._version import __version__
from .api import LipidInteraction
2 changes: 1 addition & 1 deletion pylipid/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# copies or substantial portions of the Software.
##############################################################################

__version__ = '1.5.14'
__version__ = '1.6.0'
Loading