Skip to content

Commit

Permalink
test core_def_all_beads added. [Issue #27] (#31)
Browse files Browse the repository at this point in the history
* test core_def_all_bedas added.  Small system tests added in core_fast, core_fast_leaflet and test_all_beads.
  • Loading branch information
Estefania Barreto-Ojeda committed Jun 25, 2021
1 parent bf6019b commit e60ce22
Show file tree
Hide file tree
Showing 7 changed files with 295 additions and 115 deletions.
5 changes: 1 addition & 4 deletions membrane_curvature/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
Handles the primary functions
"""

from .lib.mods import dict2pickle, core_fast, curvature
import sys
import os
from .lib.mods import dict2pickle, core_fast, curvature, def_all_beads
import time
import mdtraj as md
import MDAnalysis as mda
Expand All @@ -16,7 +14,6 @@
__author__ = "Estefania Barreto-Ojeda"
version = 0.1

sys.path.append('lib/')

def main():

Expand Down
13 changes: 13 additions & 0 deletions membrane_curvature/data/test_po4_inverted_indexes.gro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Test file 10 lipids in grid with indexes inverted. Correct form is: Index 1 belongs to lower leaflet and index 10 belong to upper leaflet.
10
3000POPE PO4 1 0.639 1.402 12.078
2054POPC PO4 2 0.704 2.229 15.981
2298POPE PO4 3 0.956 1.559 16.059
2337POPE PO4 4 0.707 0.736 15.711
2622POPC PO4 5 1.451 0.382 11.752
2702POPC PO4 6 0.081 0.610 11.835
2708POPC PO4 7 0.678 2.233 11.825
2713POPC PO4 8 0.988 0.554 11.838
2999POPE PO4 9 1.371 1.989 12.027
1923POPC PO4 10 1.361 0.630 16.101
2.60167 2.60167 32.07157
12 changes: 12 additions & 0 deletions membrane_curvature/data/test_po4_small.gro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Test file 9 lipids in grid
9
1923POPC PO4 1 0.000 0.000 15.000
2054POPC PO4 2 1.000 0.000 15.000
2298POPC PO4 3 2.000 0.000 15.000
2337POPC PO4 4 0.000 1.000 15.000
2622POPC PO4 5 1.000 1.000 12.000
2702POPC PO4 6 2.000 1.000 12.000
2708POPC PO4 7 0.000 2.000 12.000
2713POPC PO4 8 1.000 2.000 12.000
2999POPC PO4 9 2.000 2.000 12.000
3.00000 3.00000 3.00000
Binary file added membrane_curvature/data/test_po4_small.xtc
Binary file not shown.
27 changes: 7 additions & 20 deletions membrane_curvature/lib/mods.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,12 @@ def def_all_beads(lipid_types, leaflets, head_list, topology):
print('==== Lipid types in membrane ==== ')
for lt in lipid_types:
print('====>', lt)
dic_all_beads['upper'][lt] = np.concatenate((topology.select('resname ' +
lt +
' and index ' +
str(head_list[0]) +
' to ' +
str(head_list[1]) +
' and name PO4'), topology.select('resname ' +
lt +
' and index ' +
str(head_list[0]) +
' to ' +
str(head_list[1]) +
' and name GM1'))).astype(int).tolist()
dic_all_beads['lower'][lt] = np.concatenate((topology.select(
'resname ' + lt + ' and index ' + str(head_list[1] + 1) + ' to ' + str(head_list[2]) + ' and name PO4'),
topology.select(
'resname ' + lt + ' and index ' + str(head_list[1] + 1) + ' to ' + str(head_list[2]) + ' and name GM1'))).astype(int).tolist()

dic_all_beads['upper'][lt] = topology.select(
'resname ' + lt + ' and index ' + str(head_list[0])
+ ' to ' + str(head_list[1]) + ' and name PO4').astype(int).tolist()
dic_all_beads['lower'][lt] = topology.select(
'resname ' + lt + ' and index ' + str(head_list[1] + 1)
+ ' to ' + str(head_list[2]) + ' and name PO4').astype(int).tolist()
print("upper", len(dic_all_beads['upper'][lt]))
print("lower", len(dic_all_beads['lower'][lt]))

Expand Down Expand Up @@ -75,8 +63,7 @@ def dict2pickle(name, dict_):
pickle.dump(dict_, pk, protocol=pickle.HIGHEST_PROTOCOL)


def core_fast(traj, jump, n_cells, leaflets, lipid_types, lipid_ref,
box_size, max_width, prefix):
def core_fast(traj, jump, n_cells, leaflets, lipid_types, lipid_ref, max_width, prefix):
"""
Runs core_fast_leaflet for each leaflet
Expand Down
21 changes: 19 additions & 2 deletions membrane_curvature/tests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,31 @@
"""

__all__ = [
# From lower to higher complexity
"GRO_PO4_SMALL", # Gromacs file of PO4 beads in POPC POPE membrane with 10 lipids
"XTC_PO4_SMALL", # Gromacs traj file of PO4 beacs in POPC POPE membrane with 10 lipids with indexes inverted.
"GRO_PO4_INVERTED_ID",
"GRO_PO4_MED", # Gromacs file of PO4 beads in POPC POPE membrane with 25 lipids
"GRO_PO4_BIG", # Gromacs file of PO4 beads in POPC POPE membrane with 50 lipids
"GRO_PO4", # Gromacs file of PO4 beads in POPC POPE membrane with 914 lipids
"XTC_PO4", # Gromacs trajectory of GRO_PO4
"GRO_MEMBRANE_PROTEIN", # Gromacs file of POPC POPE CHOL membrane
"XTC_MEMBRANE_PROTEIN" # Gromacs trajectory of 10 frames.
"XTC_MEMBRANE_PROTEIN", # Gromacs trajectory of 10 frames.
]

from pkg_resources import resource_filename

# Membrane protein systems
GRO_MEMBRANE_PROTEIN = resource_filename(__name__, '../data/test_curvature_abca1.gro')
GRO_PO4 = resource_filename(__name__, '../data/test_curvature_po4_only.gro')
XTC_MEMBRANE_PROTEIN = resource_filename(__name__, '../data/test_curvature_abca1.xtc')
# PO4 beads only
GRO_PO4 = resource_filename(__name__, '../data/test_curvature_po4_only.gro')
XTC_PO4 = resource_filename(__name__, '../data/test_curvature_po4_only.xtc')
# Smaler systems derived from
GRO_PO4_SMALL = resource_filename(__name__, '../data/test_po4_small.gro')
XTC_PO4_SMALL = resource_filename(__name__, '../data/test_po4_small.xtc')
GRO_PO4_MED = resource_filename(__name__, '../data/test_po4_med.gro')
GRO_PO4_BIG = resource_filename(__name__, '../data/test_po4_big.gro')
# Inverted indexes
GRO_PO4_INVERTED_ID = resource_filename(__name__, '../data/test_po4_inverted_indexes.gro')
del resource_filename
Loading

0 comments on commit e60ce22

Please sign in to comment.