annotate BioPDB_align_and_rmsd.py @ 0:6352d6dd74e2 draft default tip

planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
author chemteam
date Thu, 06 Jun 2024 07:09:14 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
1 #!/usr/bin/env python3
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
2
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
3 # The MIT License
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
4 #
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
5 # Copyright (c) 2010-2016 Anders S. Christensen
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
6 #
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
7 # Permission is hereby granted, free of charge, to any person obtaining a copy
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
8 # of this software and associated documentation files (the "Software"), to deal
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
9 # in the Software without restriction, including without limitation the rights
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
10 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
11 # copies of the Software, and to permit persons to whom the Software is
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
12 # furnished to do so, subject to the following conditions:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
13 #
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
14 # The above copyright notice and this permission notice shall be included in
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
15 # all copies or substantial portions of the Software.
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
16 #
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
20 # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
23 # THE SOFTWARE.
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
24
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
25 import argparse
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
26
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
27 import Bio.PDB
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
28
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
29
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
30 def __main__():
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
31 parser = argparse.ArgumentParser(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
32 description='Residues to be aligned')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
33 parser.add_argument(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
34 '--start_residue', default=None,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
35 help='start residue')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
36 parser.add_argument(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
37 '--end_residue', default=None,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
38 help='end residue')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
39 parser.add_argument(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
40 '--ref_structure', default=None,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
41 help='reference structure')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
42 parser.add_argument(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
43 '--model', default=None,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
44 help='model structure')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
45 parser.add_argument(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
46 '--aligned_structure', default=None,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
47 help='aligned structure')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
48 parser.add_argument(
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
49 '--rmsd', default=None,
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
50 help='rmsd')
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
51 args = parser.parse_args()
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
52
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
53 # Select what residues numbers you wish to align
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
54 # and put them in a list
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
55 start_id = int(args.start_residue)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
56 end_id = int(args.end_residue)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
57 atoms_to_be_aligned = range(start_id, end_id + 1)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
58
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
59 # Start the parser
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
60 pdb_parser = Bio.PDB.PDBParser(QUIET=True)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
61
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
62 # Get the structures
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
63 ref_structure = pdb_parser.get_structure("reference", args.ref_structure)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
64 sample_structure = pdb_parser.get_structure("sample", args.model)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
65
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
66 # Use the first model in the pdb-files for alignment
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
67 # Change the number 0 if you want to align to another structure
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
68 ref_model = ref_structure[0]
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
69 sample_model = sample_structure[0]
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
70
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
71 # Make a list of the atoms (in the structures) you wish to align.
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
72 # In this case we use CA atoms whose index is in the specified range
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
73 ref_atoms = []
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
74 sample_atoms = []
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
75
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
76 # Iterate of all chains in the model in order to find all residues
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
77 for ref_chain in ref_model:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
78 # Iterate of all residues in each model in order to find proper atoms
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
79 for ref_res in ref_chain:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
80 # Check if residue number ( .get_id() ) is in the list
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
81 if ref_res.get_id()[1] in atoms_to_be_aligned:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
82 # Append CA atom to list
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
83 ref_atoms.append(ref_res['CA'])
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
84
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
85 # Do the same for the sample structure
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
86 for sample_chain in sample_model:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
87 for sample_res in sample_chain:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
88 if sample_res.get_id()[1] in atoms_to_be_aligned:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
89 sample_atoms.append(sample_res['CA'])
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
90
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
91 # Now we initiate the superimposer:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
92 super_imposer = Bio.PDB.Superimposer()
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
93 super_imposer.set_atoms(ref_atoms, sample_atoms)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
94 super_imposer.apply(sample_model.get_atoms())
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
95
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
96 # Save RMSD into an output file:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
97 with open(args.rmsd, 'w') as rmsd_out:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
98 rmsd_out.write(str(super_imposer.rms))
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
99
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
100 # Save aligned coordinates of the model:
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
101 io = Bio.PDB.PDBIO()
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
102 io.set_structure(sample_structure)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
103 io.save(args.aligned_structure)
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
104
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
105
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
106 if __name__ == "__main__":
6352d6dd74e2 planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit b90c5ab8f15397299e8baf2e903a9911c44d7668
chemteam
parents:
diff changeset
107 __main__()