memprod 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memprod
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: A program for the prediction of local membrane deformations around a protein
5
5
  Author-email: Matyas Parrag <matyas.parrag@gmail.com>
6
6
  License-Expression: GPL-3.0
@@ -77,6 +77,8 @@ MemPrOD will output the following data:
77
77
 
78
78
  * Run_command.txt - A text file containing the full run command for later reference.
79
79
 
80
+ With `-dm` (two membranes) the output folder holds `Inner/` (the membrane at -z) and `Outer/` (the membrane at +z), each with all of the above for that membrane, its part of the protein (`protein_part.pdb`) and `Membrane_Data/Membrane_centre.npz`, and a `Deformations.pdb` with both membranes' surfaces in the input's frame.
81
+
80
82
  ## Flags
81
83
  MemPrOD takes the following flags as input:
82
84
 
@@ -106,6 +108,12 @@ MemPrOD takes the following flags as input:
106
108
 
107
109
  -mt, --membrane_thickness : This indicates what the undeformed membrane thickness should be in angstroms. (Default: 38)
108
110
 
111
+ -dm, --dual_membrane : For a complex spanning two membranes, oriented by MemPrO -dm: the distance between the membrane centres in angstroms, as MemPrO reports it (`Iter-Membrane distance` in `info_rank_1.txt`). MemPrOD models one flat membrane, so each membrane is predicted on its own: the part of the protein within half the membrane's thickness plus 40 A of it is cut out, shifted so that membrane is at z = 0, and predicted with the grid kept in the protein's x,y axes (`-norot`), so both membranes' maps share the input's frame. The membrane at -z (MemPrO's inner membrane) is written to `Inner/`, the one at +z (the outer membrane) to `Outer/`. Build the system with Insane4MemPrO `-ps` (half the distance, in nm), `-def Inner/Membrane_Data/` and `-def_o Outer/Membrane_Data/`; each membrane is deformed and moved by its own `Z_change`, and the protein stays where MemPrO put it. On MacAB-TolC the outer membrane thins around TolC's barrel and the inner membrane deforms only slightly around MacB.
112
+
113
+ -mt_o, --outer_membrane_thickness : With `-dm`, the undeformed thickness of the membrane at +z in angstroms, e.g. MemPrO's `Outer Membrane Thickness`. (Default: -mt)
114
+
115
+ -norot, --no_rotation : Keep the protein's x,y axes for the grid instead of turning the protein about z to fit the grid to it. Set by `-dm` for each membrane.
116
+
109
117
  -wb, --write_bfactors : Toggles the writing of charge at each membrane segment rather than thinning/thickening.
110
118
 
111
119
  -enc, --enclosed : How to treat regions the protein encloses in the membrane, where a lipid fits but cannot be reached from outside the protein (the inside of a ring or barrel). auto predicts membrane in a region where the narrowest slice of the hydrophobic core has at least 1 nm<sup>2</sup> free and at least 60% of the residues lining it are hydrophobic (ALA, VAL, LEU, ILE, MET, PHE, TRP, CYS, PRO), the same rule as Insane4MemPrO -enclosed auto, so a lipid-filled ring such as a c-ring is predicted while a water-filled pore is not. lipids predicts membrane in every enclosed region, and empty treats them as protein (the behaviour before this option). Each region found is printed with its free area, lining and the decision. (Default: auto)
@@ -59,6 +59,8 @@ MemPrOD will output the following data:
59
59
 
60
60
  * Run_command.txt - A text file containing the full run command for later reference.
61
61
 
62
+ With `-dm` (two membranes) the output folder holds `Inner/` (the membrane at -z) and `Outer/` (the membrane at +z), each with all of the above for that membrane, its part of the protein (`protein_part.pdb`) and `Membrane_Data/Membrane_centre.npz`, and a `Deformations.pdb` with both membranes' surfaces in the input's frame.
63
+
62
64
  ## Flags
63
65
  MemPrOD takes the following flags as input:
64
66
 
@@ -88,6 +90,12 @@ MemPrOD takes the following flags as input:
88
90
 
89
91
  -mt, --membrane_thickness : This indicates what the undeformed membrane thickness should be in angstroms. (Default: 38)
90
92
 
93
+ -dm, --dual_membrane : For a complex spanning two membranes, oriented by MemPrO -dm: the distance between the membrane centres in angstroms, as MemPrO reports it (`Iter-Membrane distance` in `info_rank_1.txt`). MemPrOD models one flat membrane, so each membrane is predicted on its own: the part of the protein within half the membrane's thickness plus 40 A of it is cut out, shifted so that membrane is at z = 0, and predicted with the grid kept in the protein's x,y axes (`-norot`), so both membranes' maps share the input's frame. The membrane at -z (MemPrO's inner membrane) is written to `Inner/`, the one at +z (the outer membrane) to `Outer/`. Build the system with Insane4MemPrO `-ps` (half the distance, in nm), `-def Inner/Membrane_Data/` and `-def_o Outer/Membrane_Data/`; each membrane is deformed and moved by its own `Z_change`, and the protein stays where MemPrO put it. On MacAB-TolC the outer membrane thins around TolC's barrel and the inner membrane deforms only slightly around MacB.
94
+
95
+ -mt_o, --outer_membrane_thickness : With `-dm`, the undeformed thickness of the membrane at +z in angstroms, e.g. MemPrO's `Outer Membrane Thickness`. (Default: -mt)
96
+
97
+ -norot, --no_rotation : Keep the protein's x,y axes for the grid instead of turning the protein about z to fit the grid to it. Set by `-dm` for each membrane.
98
+
91
99
  -wb, --write_bfactors : Toggles the writing of charge at each membrane segment rather than thinning/thickening.
92
100
 
93
101
  -enc, --enclosed : How to treat regions the protein encloses in the membrane, where a lipid fits but cannot be reached from outside the protein (the inside of a ring or barrel). auto predicts membrane in a region where the narrowest slice of the hydrophobic core has at least 1 nm<sup>2</sup> free and at least 60% of the residues lining it are hydrophobic (ALA, VAL, LEU, ILE, MET, PHE, TRP, CYS, PRO), the same rule as Insane4MemPrO -enclosed auto, so a lipid-filled ring such as a c-ring is predicted while a water-filled pore is not. lipids predicts membrane in every enclosed region, and empty treats them as protein (the behaviour before this option). Each region found is printed with its free area, lining and the decision. (Default: auto)
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "memprod"
8
- version = "0.2.2"
8
+ version = "0.3.0"
9
9
  authors = [{name = "Matyas Parrag",email="matyas.parrag@gmail.com"}]
10
10
  description = "A program for the prediction of local membrane deformations around a protein"
11
11
  readme = "README.md"
@@ -12,6 +12,7 @@ import matplotlib.pyplot as plt
12
12
  import time
13
13
  from mempro import MemPrO as ori
14
14
  import argparse
15
+ import subprocess
15
16
  from scipy.optimize import OptimizeResult
16
17
  from scipy.optimize._optimize import _line_search_wolfe12, _LineSearchError
17
18
 
@@ -27,6 +28,66 @@ def pdb_atom_line(serial,name,resname,chain,resnum,x,y,z,occ=1.0,bfac=0.0):
27
28
  name = name if len(name) == 4 else " "+name
28
29
  return "ATOM %5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f\n"%(serial%100000,name[:4],resname[:3],chain[:1],resnum%10000,x,y,z,occ,bfac)
29
30
 
31
+ #Double membranes (-dm): MemPrOD's model is one flat membrane at z = 0, so each membrane of a periplasm-spanning
32
+ #complex is predicted on its own. The part of the protein within reach of the membrane is cut out and shifted so that
33
+ #membrane is at z = 0, and MemPrOD is run on it with the grid kept in the protein's x,y axes (-norot), so both
34
+ #membranes' maps share the input's frame. The membrane at -z goes to Inner/ (Insane4MemPrO -def, the -l/-u
35
+ #membrane), the one at +z to Outer/ (-def_o, the -lo/-uo membrane); each records its centre in Membrane_centre.npz.
36
+ DM_MARGIN = 40.0 #A beyond each membrane's half thickness that is kept
37
+
38
+ def dual_membrane_runs(args,orient_dir):
39
+ dist = float(args.dual_membrane)
40
+ if(dist <= 0):
41
+ print("ERROR: Could not read value of -dm. Must be the distance between the membrane centres in A (MemPrO's Iter-Membrane distance).")
42
+ exit()
43
+ lines = [l for l in open(args.file_name) if l.startswith(("ATOM","HETATM"))]
44
+ #Options passed on to each membrane's run, without the ones set here
45
+ skip = {"-f":1,"--file_name":1,"-o":1,"--output":1,"-dm":1,"--dual_membrane":1,"-mt":1,"--membrane_thickness":1,"-mt_o":1,"--outer_membrane_thickness":1}
46
+ argv,i = [],1
47
+ while i < len(sys.argv):
48
+ if sys.argv[i] in skip:
49
+ i += 1+skip[sys.argv[i]]
50
+ continue
51
+ argv.append(sys.argv[i])
52
+ i += 1
53
+ membranes = [("Inner",-dist/2,float(args.membrane_thickness)),("Outer",dist/2,float(args.outer_membrane_thickness or args.membrane_thickness))]
54
+ surfaces = []
55
+ for name,centre,thick in membranes:
56
+ sub_dir = orient_dir+name+"/"
57
+ if(not os.path.exists(sub_dir)):
58
+ os.mkdir(sub_dir)
59
+ #Whole residues, kept by their backbone (CA, or BB for CG): MemPrO's atomistic-to-CG mapping needs every atom of a
60
+ #residue, so cutting atoms by their own z at the window's edges would leave broken residues
61
+ residue = lambda l: (l[21],l[22:27],l[17:20])
62
+ backbone = {}
63
+ for l in lines:
64
+ if l[12:16].strip() in ("CA","BB") and residue(l) not in backbone:
65
+ backbone[residue(l)] = float(l[46:54])
66
+ part = []
67
+ for l in lines:
68
+ z = backbone.get(residue(l),float(l[46:54]))
69
+ if abs(z-centre) < thick/2+DM_MARGIN:
70
+ part.append(l[:46]+"%8.3f"%(float(l[46:54])-centre)+l[54:])
71
+ if(len(part) == 0):
72
+ print("ERROR: No protein within "+str(thick/2+DM_MARGIN)+" A of the membrane at z = "+str(centre)+" A")
73
+ exit()
74
+ part_fn = sub_dir+"protein_part.pdb"
75
+ open(part_fn,"w").writelines(part)
76
+ print("Membrane at z = %.1f A (%s): %d atoms/beads within %.0f A, thickness %.0f A"%(centre,name,len(part),thick/2+DM_MARGIN,thick))
77
+ run = subprocess.run([sys.executable,os.path.abspath(__file__),"-f",part_fn,"-o",sub_dir,"-mt",str(thick),"-norot"]+argv)
78
+ if(run.returncode != 0):
79
+ print("ERROR: MemPrOD failed for the membrane at z = "+str(centre)+" A")
80
+ exit(run.returncode)
81
+ np.savez(sub_dir+"Membrane_Data/Membrane_centre.npz",centre)
82
+ for l in open(sub_dir+"Deformations.pdb"):
83
+ if l.startswith("ATOM"):
84
+ surfaces.append((float(l[30:38]),float(l[38:46]),float(l[46:54])+centre,float(l[60:66])))
85
+ #Both membranes' surfaces in the input's frame, for viewing with the protein
86
+ with open(orient_dir+"Deformations.pdb","w") as f:
87
+ for k,(x,y,z,b) in enumerate(surfaces):
88
+ f.write(pdb_atom_line(k+1,"BB","DUM","Z",1,x,y,z,1.0,b))
89
+ print("Deformations of both membranes in "+orient_dir+"Inner/ and "+orient_dir+"Outer/ (Membrane_Data for Insane4MemPrO -def and -def_o), and together in "+orient_dir+"Deformations.pdb")
90
+
30
91
  def bfgs_minimize(fun,x0,jac,gtol=1e-5,maxiter=None,c1=1e-4,c2=0.9,xrtol=0):
31
92
  x0 = np.asarray(x0,dtype=float).flatten()
32
93
  N = len(x0)
@@ -118,6 +179,11 @@ def main():
118
179
  parser.set_defaults(smooth=5)
119
180
  parser.add_argument("-zshift","--zshift",help="Z shift of membrane for proteins that are misoriented due to lack of deformations.")
120
181
  parser.set_defaults(zshift=0)
182
+ parser.add_argument("-dm","--dual_membrane",help="Double membrane: the distance (A) between the membrane centres, as MemPrO -dm reports it (Iter-Membrane distance). Each membrane's deformations are predicted separately: the membrane at -z in Inner/, at +z in Outer/")
183
+ parser.set_defaults(dual_membrane=None)
184
+ parser.add_argument("-mt_o","--outer_membrane_thickness",help="With -dm, initial thickness of the membrane at +z in Angstroms (Default: -mt)")
185
+ parser.set_defaults(outer_membrane_thickness=None)
186
+ parser.add_argument("-norot","--no_rotation",action="store_true",help="Keep the protein's x,y axes for the grid instead of rotating it to fit the protein (set by -dm)")
121
187
  parser.add_argument("-mt","--membrane_thickness",help="Initial thickness of membrane in Angstroms (Default: 38)")
122
188
  parser.set_defaults(membrane_thickness=38.0)
123
189
  parser.add_argument("-wb","--write_bfactors",action="store_true",help="Toggle writing charge at each membrane segment instead of z position.")
@@ -224,6 +290,10 @@ def main():
224
290
  os.mkdir(orient_dir)
225
291
 
226
292
 
293
+ if(args.dual_membrane is not None):
294
+ dual_membrane_runs(args,orient_dir)
295
+ return
296
+
227
297
  locdir = orient_dir+"LocData/"
228
298
  if(not os.path.exists(locdir)):
229
299
  os.mkdir(locdir)
@@ -598,7 +668,7 @@ def main():
598
668
  return carry,ind
599
669
 
600
670
  carry,_ = jax.lax.scan(min_extent,[0.0,jnp.inf],jnp.arange(200))
601
- nang = carry[0]
671
+ nang = 0.0 if args.no_rotation else carry[0]
602
672
  rot_mat = jnp.array([[jnp.cos(nang),-jnp.sin(nang),0],[jnp.sin(nang),jnp.cos(nang),0],[0,0,1]])
603
673
  rot_mat_inv = jnp.array([[jnp.cos(-nang),-jnp.sin(-nang),0],[jnp.sin(-nang),jnp.cos(-nang),0],[0,0,1]])
604
674
  surf_poses = jnp.dot(rot_mat,surf_poses.T).T
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memprod
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: A program for the prediction of local membrane deformations around a protein
5
5
  Author-email: Matyas Parrag <matyas.parrag@gmail.com>
6
6
  License-Expression: GPL-3.0
@@ -77,6 +77,8 @@ MemPrOD will output the following data:
77
77
 
78
78
  * Run_command.txt - A text file containing the full run command for later reference.
79
79
 
80
+ With `-dm` (two membranes) the output folder holds `Inner/` (the membrane at -z) and `Outer/` (the membrane at +z), each with all of the above for that membrane, its part of the protein (`protein_part.pdb`) and `Membrane_Data/Membrane_centre.npz`, and a `Deformations.pdb` with both membranes' surfaces in the input's frame.
81
+
80
82
  ## Flags
81
83
  MemPrOD takes the following flags as input:
82
84
 
@@ -106,6 +108,12 @@ MemPrOD takes the following flags as input:
106
108
 
107
109
  -mt, --membrane_thickness : This indicates what the undeformed membrane thickness should be in angstroms. (Default: 38)
108
110
 
111
+ -dm, --dual_membrane : For a complex spanning two membranes, oriented by MemPrO -dm: the distance between the membrane centres in angstroms, as MemPrO reports it (`Iter-Membrane distance` in `info_rank_1.txt`). MemPrOD models one flat membrane, so each membrane is predicted on its own: the part of the protein within half the membrane's thickness plus 40 A of it is cut out, shifted so that membrane is at z = 0, and predicted with the grid kept in the protein's x,y axes (`-norot`), so both membranes' maps share the input's frame. The membrane at -z (MemPrO's inner membrane) is written to `Inner/`, the one at +z (the outer membrane) to `Outer/`. Build the system with Insane4MemPrO `-ps` (half the distance, in nm), `-def Inner/Membrane_Data/` and `-def_o Outer/Membrane_Data/`; each membrane is deformed and moved by its own `Z_change`, and the protein stays where MemPrO put it. On MacAB-TolC the outer membrane thins around TolC's barrel and the inner membrane deforms only slightly around MacB.
112
+
113
+ -mt_o, --outer_membrane_thickness : With `-dm`, the undeformed thickness of the membrane at +z in angstroms, e.g. MemPrO's `Outer Membrane Thickness`. (Default: -mt)
114
+
115
+ -norot, --no_rotation : Keep the protein's x,y axes for the grid instead of turning the protein about z to fit the grid to it. Set by `-dm` for each membrane.
116
+
109
117
  -wb, --write_bfactors : Toggles the writing of charge at each membrane segment rather than thinning/thickening.
110
118
 
111
119
  -enc, --enclosed : How to treat regions the protein encloses in the membrane, where a lipid fits but cannot be reached from outside the protein (the inside of a ring or barrel). auto predicts membrane in a region where the narrowest slice of the hydrophobic core has at least 1 nm<sup>2</sup> free and at least 60% of the residues lining it are hydrophobic (ALA, VAL, LEU, ILE, MET, PHE, TRP, CYS, PRO), the same rule as Insane4MemPrO -enclosed auto, so a lipid-filled ring such as a c-ring is predicted while a water-filled pore is not. lipids predicts membrane in every enclosed region, and empty treats them as protein (the behaviour before this option). Each region found is printed with its free area, lining and the decision. (Default: auto)
File without changes
File without changes
File without changes