Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pdbfixer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pdbfixer
Commits
4a38eb7d
Commit
4a38eb7d
authored
May 21, 2014
by
Kyle Beauchamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial revisions
parent
08c22124
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
pdbfixer/pdbfixer.py
+17
-13
tests/test_mutate.py
+5
-5
No files found.
pdbfixer/pdbfixer.py
View file @
4a38eb7d
...
...
@@ -546,7 +546,7 @@ class PDBFixer(object):
self
.
positions
=
modeller
.
positions
def
applyMutations
(
self
,
mutations
):
def
applyMutations
(
self
,
mutations
,
chain_id
,
which_model
=
0
):
"""Apply a list of amino acid substitutions to make a mutant protein.
Parameters
...
...
@@ -555,7 +555,11 @@ class PDBFixer(object):
Each string must include the resName (original), index,
and resName (target). For example, ALA-133-GLY will mutate
alanine 133 to glycine.
chain_id : str
String based chain ID of the single chain you wish to mutate.
which_model : int, default = 0
Which model to use in the pdb structure.
Notes
-----
...
...
@@ -564,21 +568,13 @@ class PDBFixer(object):
significant changes in sequence, you should probably be using
a standalone homology modelling tool.
WARNING: the current code uses zero-based indexing. not resSeq.
ToDo
----
When feature is available with OpenMM, convert this function to
use resSeq rather than index.
Examples
--------
Find nonstandard residues.
>>> fixer = PDBFixer(pdbid='1VII')
>>> fixer.applyMutations(["ALA-
16
-GLY"])
>>> fixer.applyMutations(["ALA-
57
-GLY"])
>>> fixer.addMissingHydrogens(7.0)
"""
...
...
@@ -588,9 +584,15 @@ class PDBFixer(object):
index_to_old_name
=
dict
((
r
.
index
,
r
.
name
)
for
r
in
self
.
topology
.
residues
())
index_to_new_residues
=
{}
chain_id_to_chain_number
=
dict
((
c
.
chain_id
,
k
)
for
k
,
c
in
enumerate
(
self
.
structure
.
models
[
which_model
]
.
chains
))
chain_number
=
chain_id_to_chain_number
[
chain_id
]
resSeq_to_index
=
dict
((
r
.
number
,
k
)
for
k
,
r
in
enumerate
(
self
.
structure
.
models
[
which_model
]
.
chains
[
chain_number
]))
for
mut_str
in
mutations
:
old_name
,
index
,
new_name
=
mut_str
.
split
(
"-"
)
index
=
int
(
index
)
old_name
,
resSeq
,
new_name
=
mut_str
.
split
(
"-"
)
resSeq
=
int
(
resSeq
)
index
=
resSeq_to_index
[
resSeq
]
if
index
not
in
index_to_old_name
:
raise
(
KeyError
(
"Cannot find index
%
d in system!"
%
index
))
...
...
@@ -614,6 +616,8 @@ class PDBFixer(object):
# Find atoms that should be deleted.
for
residue
,
replaceWith
in
residue_map
:
if
residue
.
chain
.
index
!=
chain_number
:
continue
# Only modify specified chain
residue
.
name
=
replaceWith
template
=
self
.
templates
[
replaceWith
]
standardAtoms
=
set
(
atom
.
name
for
atom
in
template
.
topology
.
atoms
())
...
...
tests/test_mutate.py
View file @
4a38eb7d
...
...
@@ -5,21 +5,21 @@ import tempfile
def
test_mutate_1
():
fixer
=
pdbfixer
.
PDBFixer
(
pdbid
=
'1VII'
)
fixer
.
applyMutations
([
"ALA-
16-GLY"
]
)
fixer
.
applyMutations
([
"ALA-
57-GLY"
],
"A"
)
fixer
.
addMissingHydrogens
(
7.0
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
tempfile
.
TemporaryFile
())
def
test_mutate_2
():
fixer
=
pdbfixer
.
PDBFixer
(
pdbid
=
'1VII'
)
fixer
.
applyMutations
([
"ALA-
16-GLY"
,
"SER-15-ALA"
]
)
fixer
.
applyMutations
([
"ALA-
57-GLY"
,
"SER-56-ALA"
],
"A"
)
fixer
.
addMissingHydrogens
(
7.0
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
tempfile
.
TemporaryFile
())
@raises
(
ValueError
)
def
test_mutate_3_fails
():
fixer
=
pdbfixer
.
PDBFixer
(
pdbid
=
'1VII'
)
fixer
.
applyMutations
([
"ALA-
15-GLY"
,
"SER-15-ALA"
]
)
fixer
.
applyMutations
([
"ALA-
57-GLY"
,
"SER-57-ALA"
],
"A"
)
fixer
.
addMissingHydrogens
(
7.0
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
tempfile
.
TemporaryFile
())
...
...
@@ -27,7 +27,7 @@ def test_mutate_3_fails():
@raises
(
KeyError
)
def
test_mutate_4_fails
():
fixer
=
pdbfixer
.
PDBFixer
(
pdbid
=
'1VII'
)
fixer
.
applyMutations
([
"ALA-
16-WTF"
,
"SER-15-ALA"
]
)
fixer
.
applyMutations
([
"ALA-
57-WTF"
,
"SER-56-ALA"
],
"A"
)
fixer
.
addMissingHydrogens
(
7.0
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
tempfile
.
TemporaryFile
())
...
...
@@ -35,6 +35,6 @@ def test_mutate_4_fails():
@raises
(
KeyError
)
def
test_mutate_5_fails
():
fixer
=
pdbfixer
.
PDBFixer
(
pdbid
=
'1VII'
)
fixer
.
applyMutations
([
"ALA-1000-GLY"
,
"SER-
15-ALA"
]
)
fixer
.
applyMutations
([
"ALA-1000-GLY"
,
"SER-
56-ALA"
],
"A"
)
fixer
.
addMissingHydrogens
(
7.0
)
app
.
PDBFile
.
writeFile
(
fixer
.
topology
,
fixer
.
positions
,
tempfile
.
TemporaryFile
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment