IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
mol2pca.py
1
#!/usr/bin/env python
2
3
import
IMP.em
4
5
def
main():
6
IMP.base.set_log_level
(IMP.base.SILENT)
7
usage =
"""%prog [options] <in_protein> <out_pca.cmm>
8
9
Calculates the protein principal components and writes them in cmm format.
10
The 3D points participating in the PCA calculation are the centers of voxels
11
with density above the input threshold."""
12
parser =
IMP.OptionParser
(usage=usage, imp_module=
IMP.em
)
13
(options, args) = parser.parse_args()
14
if
len(args) != 2:
15
parser.error(
"incorrect number of arguments"
)
16
in_prot_fn=args[0]
17
out_pca_fn=args[1]
18
mdl=
IMP.Model
()
19
mol=
IMP.atom.read_pdb
(in_prot_fn,mdl)
20
vecs=[]
21
for
xyz
in
IMP.core.XYZs(
IMP.core.get_leaves
(mol)):
22
vecs.append(xyz.get_coordinates())
23
pca =
IMP.algebra.get_principal_components
(vecs)
24
f=open(out_pca_fn,
"w"
)
25
IMP.em.write_pca_cmm
(pca, f)
26
f.close()
27
28
if
__name__ ==
"__main__"
:
29
main()