Permalink
Browse files

Revert "Use SeqUtils.seq1() instead of SCOP.to_one_letter_code()."

This reverts commit ca7762e.

It was causing test failure in some of the PDB code due to not
handling all the 'odd' three letter codes for modified amino
acids. I was too hasty in checking this in... opps.
  • Loading branch information...
1 parent 655111b commit ead91a06cc695ddcfa977d7d18c93b21d1cf7fc7 @peterjc peterjc committed Mar 29, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 Bio/SeqIO/PdbIO.py
View
@@ -22,8 +22,9 @@ def PdbSeqresIterator(handle):
See: http://www.wwpdb.org/documentation/format23/sect3.html
"""
- # Late-binding import to avoid circular dependency on SeqIO in Bio.SeqUtils
- from Bio.SeqUtils import seq1
+ # Late-binding import to avoid circular dependency on SeqIO in Bio.SCOP
+ # TODO - swap in Bow's SeqUtils.seq1 once that's merged
+ from Bio.SCOP.three_to_one_dict import to_one_letter_code
chains = collections.defaultdict(list)
metadata = collections.defaultdict(list)
@@ -41,7 +42,8 @@ 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 = [to_one_letter_code.get(res, 'X')
+ for res in line[19:].split()]
chains[chn_id].extend(residues)
elif rec_name == 'DBREF':
# ID code of this entry (PDB ID)
@@ -122,14 +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 to_one_letter_code.get(residue.resname, 'X')
# Deduce the PDB ID from the PDB header
# ENH: or filename?
@@ -147,7 +149,7 @@ 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 res.get_resname().upper() in to_one_letter_code]
if not residues:
continue
# Identify missing residues in the structure

0 comments on commit ead91a0

Please sign in to comment.