Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mtessmer committed May 22, 2024
2 parents 06aa26c + fd41d14 commit 4386ef0
Show file tree
Hide file tree
Showing 45 changed files with 8,453 additions and 4,266 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/PR_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: [3.11]

steps:
- uses: actions/checkout@v3
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/commit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test specified commit
on:
workflow_dispatch:
inputs:
myCommit:
description: 'Commit SHA1'
required: true
default: 'undefined'
type: string


jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.11]

steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.myCommit }}


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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Test with pytest
run: |
cd tests
pytest
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@

> [!NOTE]
> # Announcement:
>
> We are pleased to announce a free online workshop about chiLife.
>
> This workshop is held online on Wednesday, May 22, 2024 at 6:00am Pacific Time. The workshop will last about 3 hours.
>
> To participate, please register using the online registration form at https://forms.gle/r6VHt1LWKhrsK7Ww7.
>
> All registered participants will receive an email with information on how to access the online workshop and materials a few days prior to the workshop. There is no need to install chiLife or Python ahead of time.
>
> Please share this announcement with anyone potentially interested in participating.
>
> We look forward to seeing many of you!
>
> Best regards,
> Maxx Tessmer and Stefan Stoll
>
# chiLife
chiLife (or χLife) is a python package for modeling non-canonical amino acid side chain ensembles, primarily site
directed spin labels (SDSLs), and using those ensembles to predict experimental results. The goal of chiLife is to provide a
Expand Down Expand Up @@ -127,6 +147,12 @@ traj, de = xl.repack(SL1, SL2, protein=MBP, off_rotamer=True)
SL1 = xl.SpinLabel.from_trajectory(traj, site=238)
```

>Note: if you are creating a SpinLabel object from a label that is unknown to chilife you will have to specify which
> atoms the spin density primarily resides on. this is done with the ``spin_atoms`` kwarg, e.g.
> ```python
> SL1 = xl.SpinLabel.from_trajectory(traj, site=238, spin_atoms=['N1', 'O1'])
> ```
Off rotamer sampling can be controlled on a per dihedral basis when repacking with chiLife by passing a list of bools to
the off_rotamer variable. For example, passing `off_rotamer = [False, False, False, True, True]` will allow for off
rotamer sampling of only &chi;<sub>4</sub> and &chi;<sub>5</sub>.
Expand Down Expand Up @@ -222,4 +248,4 @@ And when using bifunctional label modeling please cite:
> Spin Label RX. Appl. Magn. Reson. 1–14.
Note than many rotamer libraries may also have their own references. Please use the ``chilfe.rotlib_info()`` function
on the rotamer libraries to check if there is any additional citations that should be referenced when being used.
on the rotamer libraries to check if there is any additional citations that should be referenced when being used.
4 changes: 2 additions & 2 deletions docs/source/chilife.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
χLife
======
chilife Functions
=================

General Functions
-----------------
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'sphinx_mdinclude',
'sphinx.ext.coverage',
'sphinx.ext.napoleon',
Expand Down
3 changes: 3 additions & 0 deletions docs/source/rotamer_libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ conformation is in a given protein environment.

To allow our side chain a little flexibility we can tell chiLife what the mobile dihedrals are.

.. _mobile_dihedrals:

Defining Mobile Dihedrals
--------------------------
Expand Down Expand Up @@ -106,6 +107,8 @@ Now our library can be used to perform accessible volume sampling!
.. image:: _static/MBP_E278TSP_E322TSP.png


.. _spin_atoms:

Defining Spin-atoms and Their Weights
--------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors=[{name = 'Maxx Tessmer', email='mhtessmer@gmail.com'},
{name = 'Stefan Stoll', email='stst@uw.edu'}]
keywords=['Spin-label', 'EPR', 'DEER', 'PELDOR', 'Side-chain']
dynamic = ["version"]
requires-python = ">= 3.8,<3.12"
requires-python = ">= 3.8,<3.13"
dependencies = ['numpy>=1.23.0',
'scipy>=1.6.3',
'matplotlib>=3.3.4',
Expand All @@ -16,15 +16,15 @@ dependencies = ['numpy>=1.23.0',
'tqdm>=4.45.0',
'pytest>=6.2.2',
'memoization>=0.3.1',
'argparse>=1.4.0',
'igraph>=0.11.2',
'rtoml>=0.9.0']

classifiers=['License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11']
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12']

[project.urls]
homepage = 'https://github.com/StollLab/chiLife'
Expand Down
30 changes: 16 additions & 14 deletions src/chilife/MolSys.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import MDAnalysis

from .protein_utils import sort_pdb
from .pdb_utils import sort_pdb
from .Topology import Topology
import numpy as np
from numpy.typing import ArrayLike
Expand Down Expand Up @@ -62,7 +62,7 @@ def select_atoms(self, selstr):
Returns
-------
atoms : :class:`~AtomGroup`
atoms : :class:`~AtomSelection`
Selected atoms
"""

Expand Down Expand Up @@ -271,8 +271,6 @@ def __init__(
self.charges = charges.copy()
self._fname = name

self.topology = Topology(bonds) if bonds is not None else None

self.ix = np.arange(len(self.atomids))
self.mask = np.arange(len(self.atomids))

Expand Down Expand Up @@ -337,6 +335,7 @@ def __init__(
'around': update_wrapper(partial(within, molsys=self.molsys), within)}

self.atoms = AtomSelection(self, self.mask)
self.topology = Topology(self, bonds) if bonds is not None else None

@classmethod
def from_pdb(cls, file_name, sort_atoms=False):
Expand Down Expand Up @@ -410,6 +409,7 @@ def from_arrays(cls,
segindices: ArrayLike,
segids: ArrayLike = None,
trajectory: ArrayLike = None,
**kwargs
) -> MolSys:
"""
Create a MolSys object from a minimal set of arrays.
Expand Down Expand Up @@ -474,10 +474,10 @@ def from_arrays(cls,

occupancies = np.ones(n_atoms)
bs = np.ones(n_atoms)
charges = np.zeros(n_atoms)
charges = kwargs.pop('charges', np.zeros(n_atoms))

return cls(atomids, anames, altlocs, resnames, resnums, chains,
trajectory, occupancies, bs, segids, atypes, charges)
trajectory, occupancies, bs, segids, atypes, charges, **kwargs)

@classmethod
def from_atomsel(cls, atomsel, frames=None):
Expand All @@ -488,7 +488,7 @@ def from_atomsel(cls, atomsel, frames=None):
Parameters
----------
atomsel : :class:`~AtomSelection`, MDAnalysis.AtomGroup
The :class:`~AtomSelection` or :class:`~MDAnalysis.AtomGroup` from which to create the new MolSys object.
The :class:`~AtomSelection` or MDAnalysis.AtomGroup from which to create the new MolSys object.
frames : int, Slice, ArrayLike
Frame index, slice or array of frame indices corresponding to the frames of the atom selection you wish to
extract into a new :class:`~MolSys` object.
Expand Down Expand Up @@ -549,6 +549,7 @@ def copy(self):
def load_new(self, coordinates):
"""
Load a new set (trajectory or ensemble) of 3-dimensional coordinates into the MolSys.
Parameters
----------
coordinates : ArrayLike
Expand All @@ -566,7 +567,7 @@ def _Atoms(self):
class Trajectory:
"""
Object containing and managing 3-dimensional coordinates of :class:`~MolSys` objects, particularly when there are
multiple states or time steps
multiple states or time steps.
Parameters
----------
Expand Down Expand Up @@ -991,14 +992,14 @@ def __len__(self):
return len(self.first_ix)

def __iter__(self):
for resnum in self.resnums:
mask = self.molsys.resnums == resnum
for resnum, segid in zip(self.resnums, self.segids):
mask = (self.molsys.resnums == resnum) * (self.molsys.segids == segid)
yield Residue(self.molsys, mask)


class SegmentSelection(MolecularSystemBase):
"""
An object containing a group of segements and all their atoms from a :class:`~MolSys` object. Note that if one atom
An object containing a group of segments and all their atoms from a :class:`~MolSys` object. Note that if one atom
of a segment is present in the AtomSelection used to create the group, all atoms of that segment will be present in
the SegmentSelection object.
Expand Down Expand Up @@ -1076,6 +1077,7 @@ def __init__(self, molsys, mask):
self.resnum = self.resi
self.chain = molsys.segids[self.index]
self.segid = molsys.chains[self.index]
self.charge = molsys.charges[self.index]

@property
def position(self):
Expand Down Expand Up @@ -1155,14 +1157,14 @@ def psi_selection(self):

class Segment(MolecularSystemBase):
"""
An object represeting a single segment of a molecular system.
An object representing a single segment of a molecular system.
Parameters
----------
molsys : :class:`~MolSys`
molsys : MolSys
The :class:`~MolSys` object from which the segment belongs to.
mask : int
An array of atom indices that defines the atoms of the segment
An array of atom indices that defines the atoms of the segment.
"""

def __init__(self, molsys, mask):
Expand Down
Loading

0 comments on commit 4386ef0

Please sign in to comment.