Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Use seq1 custom_map arg for PdbIO

  • Loading branch information...
commit 843447afd08f709807fd54e1c7da845328207166 1 parent e08ae43
@bow bow authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 Bio/SeqIO/
9 Bio/SeqIO/
@@ -24,6 +24,7 @@ def PdbSeqresIterator(handle):
# Late-binding import to avoid circular dependency on SeqIO in Bio.SeqUtils
from Bio.SeqUtils import seq1
+ from Bio.SCOP.three_to_one_dict import to_one_letter_code
chains = collections.defaultdict(list)
metadata = collections.defaultdict(list)
@@ -41,7 +42,7 @@ def PdbSeqresIterator(handle):
chn_id = line[11]
# Number of residues in the chain (repeated on every record)
# num_res = int(line[13:17])
- residues = [seq1(res) for res in line[19:].split()]
+ residues = [seq1(res, custom_map=to_one_letter_code) for res in line[19:].split()]
elif rec_name == 'DBREF':
# ID code of this entry (PDB ID)
@@ -123,13 +124,14 @@ def PdbAtomIterator(handle):
# Only import PDB when needed, to avoid/delay NumPy dependency in SeqIO
from Bio.PDB import PDBParser
from Bio.SeqUtils import seq1
+ from Bio.SCOP.three_to_one_dict import to_one_letter_code
def restype(residue):
"""Return a residue's type as a one-letter code.
Non-standard residues (e.g. CSD, ANP) are returned as 'X'.
- return seq1(residue.resname)
+ return seq1(residue.resname, custom_map=to_one_letter_code)
# Deduce the PDB ID from the PDB header
# ENH: or filename?
@@ -147,7 +149,8 @@ def restype(residue):
for chn_id, chain in sorted(model.child_dict.iteritems()):
# HETATM mod. res. policy: remove mod if in sequence, else discard
residues = [res for res in chain.get_unpacked_list()
- if seq1(res.get_resname().upper()) != "X"]
+ if seq1(res.get_resname().upper(),
+ custom_map=to_one_letter_code) != "X"]
if not residues:
# Identify missing residues in the structure

0 comments on commit 843447a

Please sign in to comment.
Something went wrong with that request. Please try again.