GithubHelp home page GithubHelp logo

p-j-smith / lipyphilic Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 11.0 16.02 MB

A Python toolkit for the analyis of lipid membrane simulations

Home Page: https://lipyphilic.readthedocs.io/en/latest/

License: Other

Python 98.34% Rust 1.66%
lipids molecular-dynamics python3

lipyphilic's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lipyphilic's Issues

Analysis to identify lipid - non-lipid neighbours

Is your feature request related to a problem? Please describe.
lipyphilic.lib.Neighbours currently finds all lipid-lipid neighbours in a membrane. However, it would be useful to be able to find lipid - non-lipid neighbours, such as lipid-water or lipid-drug. This would enable the calculation of the local lipid environemnt of permeants as they diffuse through a membrane.

Describe the solution you'd like
Add an optional neighbour_sel keyword to lipyphilic.lib.Neighbours. If provided, neighbours between residues in lipid_sel and neighbour_sel would be identified. The default would be None, in which case lipid-lipid neighbours would be found.

Describe alternatives you've considered
Create a new class for the lipid - non-lipid neighbour analysis. This might be easier than modifying the largest_cluster and count_neighbours methods to handle both lipid and non-lipid neighbours.

Additional context
Ghysels et al. calculated the local lipid environment of water molecules as they permeate through bilayers.

'nojump' raises an exception when used with triclinic systems

Describe the bug
lipyphilic.transformations.nojump can't be used with triclinic systems - it always raises a ValueError because the system is triclinic, even if the lipyphilic.transformations.triclinic_to_orthorhombic is used first.

To Reproduce

from lipyphilic._simple_systems.simple_systems import TRICLINIC
from lipyphilic.transformations import nojump, triclinic_to_orthorhombic

universe = MDAnalysis.Universe(TRICLINIC)
atoms = universe.atoms
universe.trajectory.add_transformations(
    triclinic_to_orthorhombic(ag=atoms),
    nojump(ag=atoms, nojump_x=True, nojump_y=True, nojump_z=True),
)

Expected behaviour
No error is raised.

Actual behaviour
The following error is raised:

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/Users/paul/git/lipyphilic/src/lipyphilic/transformations.py", line 197, in __init__
    raise ValueError("nojump requires an orthorhombic box. Please use the on-the-fly "
ValueError: nojump requires an orthorhombic box. Please use the on-the-fly transformation :class:`lipyphilic.transformations.triclinic_to_orthorhombic` before calling nojump

Additional context

  • Which version of lipyphilic are you using?
    0.10
  • Which version of Python are you using?
    3.10

Use the new MDAnalysis Results class to store analysis results

Is your feature request related to a problem? Please describe.
MDAnalysis has a new Results class that is used to store the output each of the analysis classes. This common API is designed to make it easier for the MDA CLI to extract the results of an analysis.

Describe the solution you'd like
Update all lipyphilic analysis classes to store results in a .results attribute using the Results class.

Describe alternatives you've considered
Don't update to the new Results class. However, if we update, it looks like it would be relatively straightforward to piggyback on the MDA CLI to create one for lipyphilic.

Additional context
See MDAnalysis/mdanalysis#3261

Bending rigidity and tilt modulus

Is your feature request related to a problem? Please describe.
I would like a tool to calculate the bending rigidity of a lipid membrane.

Describe the solution you'd like
An implementation of the method developed by Doktorova et al., based on analysis of the real-space fluctuations of lipid splay and tilt.

Describe alternatives you've considered
Calculate the bending rigidity by fitting to a stress-strain relation (i.e. the methodology developed by Hossein and Deserno.

Additional context
The approach developed by Doktorova et al. requires the calculation of local membrane normals as well as lipid director vectors. These could be implemented in two separate analysis classes as they may each be useful for other analyses.

Angle of lipid with the z-axis

Is your feature request related to a problem? Please describe.
I would like to know the angle cholesterol makes with the z-axis in my bilayer.

Describe the solution you'd like
A tool to calculate the angle a lipid makes with a given vector (default to the positive z-axis)

Describe alternatives you've considered
Don't bother - it's relatively simple to calculate anyway. However, the behaviour of the tool would be validated through unit testing, and through vectorisation it would be faster than a simple for-loop based implementation.

Additional context
If a tool to calculate height in z of a lipid is also implemented (issue #19 ), the two together would make it very simple to calculate the free energy profile of e.g. cholesterol height vs angle. See Figure 5 in Baral et al. (2020).

IndexError in Neighbours analysis

Describe the bug
When using lipyphilic.lib.neighbours.Neighbours, if the provided lipid_sel does not cover all lipids in the bilayer then an error is thrown. This only happens is the residue indices of the selected lipids do not start from zero or are non-sequential.

To Reproduce

from lipyphilic.lib.neighbours import Neighbours
from lipyphilic._simple_systems.simple_systems import HEX_LAT

u = mda.Universe(HEX_LAT)
neighbours = Neighbours(
    universe=u,
    lipid_sel="name C"  # select only cholesterol
)
neighbours.run()

Expected behaviour
The analysis should run in the same way it would if the selection covered all lipids in the bilayer.

Actual behaviour
Here's the stack trace:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-121-37a1440ef5a9> in <module>
----> 1 neighbours.run()

~/git-repos/lipyphilic/src/lipyphilic/lib/base.py in run(self, start, stop, step, verbose)
    192             self.times[i] = ts.time
    193             # logger.info("--> Doing frame {} of {}".format(i+1, self.n_frames))
--> 194             self._single_frame()
    195         logger.info("Finishing up")
    196         self._conclude()

~/git-repos/lipyphilic/src/lipyphilic/lib/neighbours.py in _single_frame(self)
    300         # store neighbours for this frame
    301         frame_start = self._frame_index * self.membrane.n_residues
--> 302         self.neighbours[ref, neigh + frame_start] = 1
    303         self.neighbours[neigh, ref + frame_start] = 1  # the neighbour matrix must be symmetric
    304 

~/miniconda3/envs/lpp/lib/python3.8/site-packages/scipy/sparse/lil.py in __setitem__(self, key, x)
    331             return self._set_intXint(key[0], key[1], x)
    332         # Everything else takes the normal path.
--> 333         IndexMixin.__setitem__(self, key, x)
    334 
    335     def _mul_scalar(self, other):

~/miniconda3/envs/lpp/lib/python3.8/site-packages/scipy/sparse/_index.py in __setitem__(self, key, x)
    123                 return
    124             x = x.reshape(i.shape)
--> 125             self._set_arrayXarray(i, j, x)
    126 
    127     def _validate_indices(self, key):

~/miniconda3/envs/lpp/lib/python3.8/site-packages/scipy/sparse/lil.py in _set_arrayXarray(self, row, col, x)
    303     def _set_arrayXarray(self, row, col, x):
    304         i, j, x = map(np.atleast_2d, _prepare_index_for_memoryview(row, col, x))
--> 305         _csparsetools.lil_fancy_set(self.shape[0], self.shape[1],
    306                                     self.rows, self.data,
    307                                     i, j, x)

_csparsetools.pyx in scipy.sparse._csparsetools.lil_fancy_set()

_csparsetools.pyx in scipy.sparse._csparsetools._lil_fancy_set_int64_int8()

_csparsetools.pyx in scipy.sparse._csparsetools.lil_insert()

IndexError: row index (51) out of bounds

Additional context

  • Which version of lipyphilic are you using? 0.2.0
  • Which version of Python are you using? 3.8
  • Which OS are you using? Ubuntu 20.04.1 LTS

[QUESTION] error aboubt "Calculate 2D PMFs from joint probability distributions"

What is the topic of your question: Installation / Usage / Documentation / Other
Please indicate the topic in the title of your question

Add your question below:
After I learned to use a script to compute two-dimensional PMFS from joint probability distributions, I got an error: ValueError: 'ob1' and 'ob2' must be arrays of the same shape. but the length of ob1 equal to length of ob2:
image
can you help me ?

APL projection plot

Is your feature request related to a problem? Please describe.
I can plot the area per lipid projected onto the membrane plane using lipyphilic.lib.plotting.ProjectionPlot. This class requires lipid x and y positions as well as time-averaged values of each lipid. I would like lipyphilic to extract this information for me.

Describe the solution you'd like
A AreaPerLipid.project_areas() method, similar to lipid order parameter analysis class' lipyphilic.lib.SCC.project_SCC().

Describe alternatives you've considered
Write a tutorial notebook on how to extract x positions, y positions, and mean area per lipid values to pass to lipyphilic.lib.plotting.ProjectionPlot, as there are likely many more properties that people may want to plot as projections onto the membrane plane.

Additional context

[FEATURE] register lipyphilic as an MDAKit

Hi @p-j-smith , the MDAKits registry https://mdakits.mdanalysis.org/ is operational and it would be great to have your package in there. I am pretty sure lipyphilic fulfills all requirements (tests, docs, installable, and uses MDAnalysis) so it should be easy to add — essentially just a PR with a meta data file.

@ianmkenney recently created a MDAkits tutorial that provides information on how to create an MDAKit. It starts from scratch with the cookiecutter but that's obviously not necessary for a complete package like yours so you can probably start at Submitting the kit to the registry.

If you have questions, please ask — on our Discord we have a whole mdakits channel and of course there's also the developer list. We also have more information about MDAKits on the website.

Typos in docs

Which section of the documentation needs improving?
Lots of them - there are typos throughout the docs.

How to improve this section
* ZAngles - Is the vector from B to A or A to B? The docs suggest both.
* AreaPerLipid - the sentences starting with "Area data are returned in a numpy.ndarray, ..." are repeated.
* AreaPerLipid.project_area(): start, stop and filter_by refer to SCC rather than AreaPerLipid.
* AreaPerLipid: Add note to the docstring to say if the membrane is curved, either FatSlim, MemSurfer, or ML-LPA should be used to calculate the area per lipid
* SCC: In describing the output, "The Scc order parameter data..." should be "The order parameter data..."

I'm sure there are lots more too.

lipyphilic.lib import error

Hi,
I am getting following error when importing lib modules. Is this due to announced API changes and moving modules from lib to analysis? Or is the problem on my side?

Traceback (most recent call last):
File "/mnt/c/Users/neube/Data/nuclear_membrane/lipyphilic_z_thickness.py", line 2, in
from lipyphilic.lib.z_positions import ZThickness
ImportError: cannot import name 'ZThickness' from 'lipyphilic.lib.z_positions' (/home/mineu/anaconda3/envs/lipyphilic/lib/python3.11/site-packages/lipyphilic/lib/z_positions.py)

I also tried to changelib for analysis in the code and it does not work (ModuleNotFoundError: No module named 'lipyphilic.analysis')
Thanks!

`AssignLeaflets` fails when `xy` dimensions are not equal

Hi @p-j-smith and @pablo-arantes, I had encountered the same IndexError a while ago (still in version 0.9.0, but as far as I can tell this part is unchanged in 0.10.0). The problem appeared always when having different x and y dimensions, i.e., AssignLeaflets works fine on square membranes, and fails otherwise.

At least in my case, the problem is not caused by missing z positions in self.membrane.positions. In my test case the y dimension is roughly twice as long as the x dimension. Then the IndexError is caused by lipid_y_bins having some bin indices = 2 and memb_midpoint_xy.shape being (2,2). Apparently, the incorrect bin indices are caused by usage of the same bins for x and y in scipy.stats.binned_statistic_2d.

The problem is solved by

        x_bins = memb_midpoint_xy.x_edge
        y_bins = memb_midpoint_xy.y_edge
     
        # get the binnumbers for each lipid
        lipid_x_bins, lipid_y_bins = scipy.stats.binned_statistic_2d(
            x=self.membrane.positions[:, 0],
            y=self.membrane.positions[:, 1],
            values=self.membrane.positions[:, 2],
            statistic="mean",
            bins=(x_bins, y_bins),
            expand_binnumbers=True
        ).binnumber -1  # These were bin numbers, now bin indices  # noqa: E225

and similar changes in the other calls to scipy.stats.binned_statistic_2d

Originally posted by @kaistroh in #101 (comment)

[BUG] ValueError when calling scc.project_SCC

Describe the bug
When projecting the SCC onto the xy plane by calling scc.project_SCC the following error is raised:

ValueError: AtomGroup was not contiguous from bonds, process failed

This is an issue with the MDAnalysis ag.unwrap method.

To Reproduce

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import CONECT

u = mda.Universe(CONECT)
u.atoms.unwrap()

...
**Additional context**
This is caused by always setting `unwrap=True` when determining the center of mass of each lipid in `project_SCC`. There should be an keyword to not unwrap the lipids. 

[BUG] Conda installation fails on macos

Describe the bug
Conda installation fails on MacOS. The following error occurs:

CondaVerificationError: The package for lipyphilic located at 
Users/paul/opt/anaconda3/pkgs/lipyphilic-0.9.0-pyhd8ed1ab_0 appears to be corrupted. 
The path 'site-packages/lipyphilic/_simple_systems/xtcs/._HexGrid-2AtomsPerLipid-TranslatedIn_y_nojump.xtc_offsets.npz' specified in the package manifest cannot be found.

To Reproduce

conda install -c conda-forge lipyphilic

Additional context

  • Which OS are you using? MacOS, BigSur

[BUG]nojump fails with concatenated trajectories

Hello,

Thanks a lot for the code, it has been more than helpful.

After I use MDAnalysis to load two trajectory files simultaneously, I add the lattice parameters using u.dimensions. However, when I use nojump, the code seems to allocate the lattice parameters to the first trajectory only, not the second part. I got the following error:
ValueError: No dimensions information in Universe. Either use the 'box' argument or set the '.dimensions' attribute
The code fails at 20% of the job. The length of the trajectories is 2ns and 8ns respectively.

Here is the code I use, it has been working well with a single trajectory :

u = mda.Universe(traj1, traj2, all_coordinates = True, dt = 1)

u.dimensions = [30.6191, 30.6191, 30.6191, 90, 90, 90]

u.trajectory.add_transformations(nojump(ag=u.select_atoms('bynum 1'), 
                                                nojump_x=True,
                                                nojump_y=True,
                                                nojump_z=True))

Thanks a lot in advance.

[BUG] Index error from AssignLeaflets with the AMBER force field

Describe the bug
Get an Index Error when running AssignLeaflets with a system built with AMBER forcefield. The membrane contains POPC.

To Reproduce
A minimal working example of code to reproduce the unexpected behaviour.

import MDAnalysis as mda
from lipyphilic.lib.assign_leaflets import AssignLeaflets
from lipyphilic.lib.area_per_lipid import AreaPerLipid

u = mda.Universe("system_amber_nw.prmtop", "prod_wat_memb1-1_nw.dcd")

leaflets = AssignLeaflets(
  universe=u,
  lipid_sel = 'resname POP and name P O11 O12 O13 O14'
)
leaflets.run()

areas = AreaPerLipid(
  universe=u,
  lipid_sel='resname POP and name P O11 O12 O13 O14',
  leaflets=leaflets.leaflets
)
areas.run()


Expected behaviour
Run smoothly and store results in leaflets.leaflets attribute

Actual behaviour
Get an Index Error

IndexError                                Traceback (most recent call last)
[<ipython-input-32-3913732d68c0>](https://localhost:8080/#) in <module>
     14   lipid_sel = "name P"
     15 )
---> 16 leaflets.run()
     17 
     18 areas = AreaPerLipid(

2 frames
[/usr/local/lib/python3.8/site-packages/lipyphilic/lib/assign_leaflets.py](https://localhost:8080/#) in _assign_leaflets(self, memb_midpoint_xy)
    432         upper_leaflet = self.membrane[
    433             self.membrane.positions[:, 2] >
--> 434             (memb_midpoint_xy.statistic[lipid_x_bins, lipid_y_bins])  # we don't to consider midplane_cutoff here
    435         ]
    436         self.leaflets[

IndexError: index 2 is out of bounds for axis 1 with size 2

Additional context

  • LiPyphilic 0.10.0
  • Python 3.8
  • Ubuntu distribution of Linux

Orientational order parameter

Is your feature request related to a problem? Please describe.
Currently lipyphilic has a tool to calculate the coarse grained orientational order parameter over individual lipids (rather than along a tail). However, a tool to calculate the orientaitonal order parameter in all-atom systems (as a function of carbon position along a tail) would be very useful.

Describe the solution you'd like
A new analysis class to calculate the orientational order parameter along an acyl tail.

Describe alternatives you've considered

Additional context
See Piggot et al. for a discussion on the correct way to calculate the orientational order parameter, including for unsaturated acyl tails.

[BUG]AssignLeaflets failed when working with a system using CHARMM forcefield

Describe the bug
Get an Index Error when running AssignLeaflets with a system built with CHARMM forcefield. The membrane contains POPE and POPG.

To Reproduce

import MDAnalysis as mda
from lipyphilic.lib.assign_leaflets import AssignLeaflets

u = mda.Universe('md.tpr','md.xtc')

leaflets = AssignLeaflets(
    universe=u,
    lipid_sel="name P"
)
leaflets.run(start=None, stop=None, step=None)

Expected behaviour
Run smoothly and store results in leaflets.leaflets attribute

Actual behaviour
Get an Index Error

IndexError                                Traceback (most recent call last)
<ipython-input-7-a7e32bcee85f> in <module>
      3     lipid_sel="name P"
      4 )
----> 5 leaflets.run(start=None, stop=None, step=None)

~/miniconda3/envs/py36/lib/python3.6/site-packages/lipyphilic/lib/base.py in run(self, start, stop, step, verbose)
    192             self.times[i] = ts.time
    193             # logger.info("--> Doing frame {} of {}".format(i+1, self.n_frames))
--> 194             self._single_frame()
    195         logger.info("Finishing up")
    196         self._conclude()

~/miniconda3/envs/py36/lib/python3.6/site-packages/lipyphilic/lib/assign_leaflets.py in _single_frame(self)
    395 
    396         # Assign leaflets
--> 397         self._assign_leaflets(memb_midpoint_xy)
    398 
    399         # if necessary, find midplane residues

~/miniconda3/envs/py36/lib/python3.6/site-packages/lipyphilic/lib/assign_leaflets.py in _assign_leaflets(self, memb_midpoint_xy)
    426         upper_leaflet = self.membrane[
    427             self.membrane.positions[:, 2] >
--> 428             (memb_midpoint_xy.statistic[lipid_x_bins, lipid_y_bins])  # we don't to consider midplane_cutoff here
    429         ]
    430         self.leaflets[

IndexError: index 2 is out of bounds for axis 0 with size 2

Additional context

  • Which version of lipyphilic are you using?
    0.6.3
  • Which version of Python are you using?
    Python 3.6
  • Which OS are you using?
    Ubuntu 16.04.7 LTS

Coarse-grained order parameter

Is your feature request related to a problem? Please describe.
I would like to know the coarse-grained order parameter (SCC) of lipids in my bilayer.

Describe the solution you'd like
A tool to calculate the SCC of each tail in the bilayer.

Describe alternatives you've considered
A more general tool to calculate the lipid order parameter, able to handle both atomistic (SCH) and coarse grained (SCC) models. In the atomistic case it should also handle unsaturated carbons correctly. See Piggot et al. (2020) for more information. However, many tools to calculate SCH already exist.

Additional context
SCC is described in Seo et al. (2020)

Automate build and release

I was previously manually building wheels and uploading to PyPI. This should instead be automate through a github action

Membrane thickness

Is your feature request related to a problem? Please describe.
I would like to know the thickness (in z) of my membrane.

Describe the solution you'd like
An analysis tool to calculate the z thickness of a bilayer. This would be done by constructing two intrinsic surfaces - one of the upper leaflet and one of the lower leaflet, finding the height in z at each point on the surface and averaging the get the bilayer thickness at a given frame.

Describe alternatives you've considered
The approach to calculating membrane thickness taken by FatSlim is interesting, although it is more computationally intensive.

Additional context
Add any other context or screenshots about the feature request here.

Lipid tail interdigitation

Is your feature request related to a problem? Please describe.
Lipid interdigitation is thought to play a role in nanodomain registration and other membrane processes.

Describe the solution you'd like
An analysis tool to calculate the interdigitation of each tail in a lipid bilayer.

Describe alternatives you've considered

  • A more general tool that can also calculate interdigitation in non-bilayer membranes.

  • An analysis to calculate the overlap parameter between leaflets, rather than the interdigitation of each tail

Additional context
See Smith et al. for details on how to calculate the interdigitation of each acyl tail.

[BUG] Flip flop algorithm finds events that start midway through another event

Describe the bug
The Flip Flop analysis tool sometimes identifies flip flop events as starting in the middle of another event. e.g. If a lipid is moving from the upper to lower leaflet, and a frame cutoff > 1 is used, if the lipid is temporarily in the lower leaflet then returns to the middle or upper leaflet, the flip flop tool will suggest a second event has started - originating in the lower leaflet. However, this fluctuation into and out of the lower leaflet should not be regarded as a new event in itself - it is a part of the event that originated in the upper leaflet.

There is no simple fix for this. Likely a new algorithm will be needed.

Lipid thickness tool

Is your feature request related to a problem? Please describe.
I would like a tool to calculate the thickness of lipids (or their tails) in the z dimension, as this is a useful input feature for creating Hidden Markov Models to identify phase separation in lipid membranes.

Describe the solution you'd like
A tool to calculate the thickness of lipids (or their tails) in the z dimension.

Describe alternatives you've considered
Don't bother - it's quite easy to calculate anyway. But this would be force-field agnostic and still save everyone writing a short script. Plus the results array would be in a format that makes it simple to pass them to e.g. Pomegranate to construct a HMM.

Additional context
See Park and Im (2018) for a description of how to use lipid tail thicknesses to create HMMs.

Plotting joint density distributions

Is your feature request related to a problem? Please describe.
lipyphilic generally returns analysis results for each lipid at each frame. This makes it straightforward to plot joint probability distributions or 2D PMFs.
Describe the solution you'd like
A general tool for plotting joint probability distributions or PMFs of any two observables.

Describe alternatives you've considered
Make a tool for plotting orientation vs height only. Would be simpler to implement but less flexible.

Additional context
See the PMF of cholesterol orientation and height in Baral et al. (2020), calculated directly from the probability distribution.

[BUG] Unexpected uniform thickness calculated by MembThickness

Describe the bug
A clear and concise description of what the bug is.
I am trying to plot a 2D membrane thickness map, using the instructions found in the API documentation. I assign my leaflets, and I have verified that this all works ok, and when I calculate the global membrane thickness it gives a plausible value. However when I use the return_surface keyword to give local membrane thicknesses, the code just appears to copy the global value and replicate it at all grid points i.e. I don't get the local data. This occurs with and without interpolation.

To Reproduce
u = mda.Universe("step7_production.tpr", "step7_production.part0002.xtc")

leaflets = AssignLeaflets(
universe=u,
lipid_sel="name PO1 PO2 PO4",n_bins=50 # assuming we are using the MARTINI forcefield
)
leaflets.run(verbose=True,start=9800,stop=9801)

memb_thickness = MembThickness(
universe=u,
leaflets=leaflets.filter_leaflets("resname RAMP POPE POPG"),
lipid_sel="(resname RAMP POPE POPG and name PO1 PO2 PO4)",n_bins=50,return_surface=True,interpolate=True
)

memb_thickness.run(
start=9800,
stop=9801,
step=None,
verbose=True
)


**Expected behaviour**
I get a 2D membrane thickness map with differing values at each grid point
**Actual behaviour**
A 2D membrane thickness map with exact the same value at each point (the global membrane thickness)

[[[40.11803949 40.11803949 40.11803949 ... 40.11803949 40.11803949
   40.11803949]
  [40.11803949 40.11803949 40.11803949 ... 40.11803949 40.11803949
   40.11803949]
  [40.11803949 40.11803949 40.11803949 ... 40.11803949 40.11803949
   40.11803949]
  ...
  [40.11803949 40.11803949 40.11803949 ... 40.11803949 40.11803949
   40.11803949]
  [40.11803949 40.11803949 40.11803949 ... 40.11803949 40.11803949
   40.11803949]
  [40.11803949 40.11803949 40.11803949 ... 40.11803949 40.11803949
   40.11803949]]]
**Additional context**

- Which version of lipyphilic are you using?
0.0.10
- Which version of Python are you using?
3.9.12
- Which OS are you using?
Ubuntu

the error of "from lipyphilic.lib.z_positions import ZThickness"

What is the topic of your question: Installation / Usage / Documentation / Other
Please indicate the topic in the title of your question
the error of "from lipyphilic.lib.z_positions import ZThickness"
Add your question below:
i was use the conda install lipyphilic and succeed, but when i use the lipyphilic report the follow error:

image

can you help me to tackle this problem?

[QUESTION]Units of diffusion coefficient

What is the topic of your question: Usage / Documentation, maybe Bug

Add your question below:
When I run the LyPyphilic lateral_diffusion.MSD module on simulations of Amber Lipid21 lipids in GROMACS and then calculate the diffusion coefficient, I get an answer that is the wrong order of magnitude for standard lipids. The following code is based off the example notebook.

import matplotlib.pyplot as plt
from lipyphilic.lib import lateral_diffusion
import MDAnalysis as mda
from MDAnalysis import transformations as mda_transformations
from lipyphilic import transformations as lpy_transformations

def get_diffusion(u, sel_str):
  msd = lateral_diffusion.MSD(
    universe=u,
    lipid_sel=sel_str,
    com_removal_sel=sel_str,
    dt=0.2
  )

  msd.run(verbose=True)
  return msd

# Load DOPC
u_DO = mda.Universe('../big_DOPC/md.tpr', '../big_DOPC/md.xtc')
lipids_DO = u_DO.select_atoms("moltype OOPC")
t_DO = [lpy_transformations.triclinic_to_orthorhombic(lipids_DO), mda_transformations.NoJump(lipids_DO)]
u_DO.trajectory.add_transformations(*t_DO)

# Load DLPC
u_DL = mda.Universe('../DLPC/md.tpr', '../DLPC/md.xtc')
lipids_DL = u_DL.select_atoms("moltype LLPC")
t_DL = [lpy_transformations.triclinic_to_orthorhombic(lipids_DL), mda_transformations.NoJump(lipids_DL)]
u_DL.trajectory.add_transformations(*t_DL)

# Compute msd
msd_DO = get_diffusion(u_DO, 'moltype OOPC')
msd_DL = get_diffusion(u_DL, 'moltype LLPC')
mean_msd_DL = np.mean(msd_DL.msd, axis=0)
mean_msd_DO = np.mean(msd_DO.msd, axis=0)

# Make plot of msd/time
fig, ax = plt.subplots()
ax.loglog(msd_DL.lagtimes, mean_msd_DL, label="DLPC")
ax.loglog(msd_DO.lagtimes, mean_msd_DO, label='DOPC')
ax.set_xlabel("Lagtime (ns)")
ax.set_ylabel(r"MSD$_{xy}\ \rm{(nm^2)}$")
plt.legend()
plt.show()

# Calculate diffusion coefficient
d_DL, sem_DL = msd_DL.diffusion_coefficient()
d_DO, sem_DO = msd_DO.diffusion_coefficient()
print("lipid\tDiff\tstdev")
print(f"DLPC {d_DL:.2e} {sem_DL:.2e}")
print(f"DOPC {d_DO:.2e} {sem_DO:.2e}")

The resulting graph shows really high MSD:
image

And the diffusion coefficients are ~10000x too large

lipid Diff stdev
DLPC 6.11e-04 6.09e-05
DOPC 2.40e-03 3.60e-05

Lipid diffusivity should be on the order of 1e-8 cm^2/sec, and Amber Lipid14 did capture this (table 9) (there isn't diffusion data in the Lipid21 paper)

I have tried messing with the dt argument of MSD. My simulation uses a tilmestep of 0.002 ps (2 fs) and saves a trajectory frame every 100000 steps (200 ps = 0.2 ns). Therefore I wouldn't expect that setting dt to 0.2 would change anything, but setting it does change the calculated diffusion coefficient (2 orders of magnitude higher when set). The documentation says:

dt (float, optional) – The time, in nanoseconds, between consecutive frames in universe.trajectory. The defualt is None, in which case dt is taken to be universe.trajectory.dt divided by 1000.

In my code, u_DO.trajectory.dt is 200, so if I were to not set dt, the result should also be 0.2.

Is there something I am not understanding, or is there maybe a unit conversion error somewhere in the code?

Height of lipids in z

Is your feature request related to a problem? Please describe.
I would like to know the z position of cholesterol in my bilayer.

Describe the solution you'd like
A tool to calculate the height in z of specific lipids in a bilayer.

Describe alternatives you've considered
Don't bother - it's relatively simple to calculate anyway. However, the behaviour of the tool would be validated through unit testing, and through vectorisation it would be faster than a simple for-loop based implementation.

Additional context
If a tool to calculate lipid angle vs the z axis is also implemented, the two together would make it very simple to calculate the free energy profile of e.g. cholesterol height vs angle. See Figure 5 in Baral et al. (2020).

Unwrap a membrane split across periodic boundaries

Is your feature request related to a problem? Please describe.
Sometimes during a simulation a micelle or bilayer will become split across periodic boundaries. Later unwrapping the membrane can be a hassle. It is possible with GROMACS, but slow as it requires clustering of every lipid at each frame. It is not possible to use unwrap() in MDAnalysis as this works only for fully connected molecules, not supramolelcular structures.

Describe the solution you'd like
An efficient method unwrapping and centering bilayers/micelles.

Memory and performance issue with lipyphilic.lib.neighbours.Neighbours

Is your feature request related to a problem? Please describe.
lipyphilic.lib.neighbours.Neighbours uses a SciPy lil_matrix to construct the adjacency matrix. This becomes very slow in large systems (>10,000 lipids, with hundreds or thousands of frames).

Describe the solution you'd like
Use a different matrix format for constructing the adjacency matrix.

Additional context
For a system of 12,000 lipids, the first frame took around 0.2 seconds to append the neighbours to the lil_matrix. By frame 2880, it takes around 1 minute per frame.

[BUG] ValueError when setting 'norm' keyword of 'imshow_kws' in 'ProjectionPlot'

Describe the bug
If the norm keyword of imshow_kws is passed to ProjectionPlot.plot_projection the following ValueError is raised:

ValueError: Passing parameters norm and vmin/vmax simultaneously is not supported. Please pass vmin/vmax directly to the norm when creating it.

This occurs when using versions of matplotlib greater than 3.4.3.

No documentation on how to access the 2D surface returned by `MembThickness`

Which section of the documentation needs improving?
Please provide a link (if it is a specific page).

https://lipyphilic.readthedocs.io/en/latest/reference/analysis/memb_thickness.html#lipyphilic.analysis.memb_thickness.MembThickness

What can be improved about this section
Is it incomplete, incorrect or difficult to understand?

As pointed out int #142, there is no documentation on how to access the 2D surface returned by MembThickness if return_surface is true.

How to improve this section
Do you have any specific suggestions we could take to improve the documentation?

The surface is stored in the attribute memb_thickness_grid:

if self._return_surface:
self.memb_thickness_grid = np.full(
(self.n_frames, self.n_bins, self.n_bins),
fill_value=np.NaN,
)

This should be added to the description of the return_surface argument.

Leaflet registration

Is your feature request related to a problem? Please describe.
I would like to be able to calculate the interleaflet registration of cholesterol, or of ordered domains in phase-separated systems.

Describe the solution you'd like
A general tool to calculate registration, either of subset of lipid species (e.g sterols) or a subset of lipids with a user-defined value (e.g Lo phase).

Describe alternatives you've considered
Limit the analysis to look at cholesterol only. Easier to implement but less flexible.

Additional context
See the SI of Cholesterol Flip-Flop Impacts Domain Registration in Plasma Membrane Models for a description of how to evaluate interleaflet registration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.