Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
nisse committed May 9, 2004
1 parent 6e12091 commit e1b4434
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Bio/PDB/NeighborSearch.py
Expand Up @@ -11,15 +11,15 @@

class NeighborSearch:
"""
This module can be used in two ways:
This class can be used for two related purposes:
1. To find all atoms/residues/chains/models/structures within radius
of a given query vector.
of a given query position.
2. To find all atoms/residues/chains/models/structures that are within
a fixed radius of each other.
NeighborSearch makes use of the KD tree C++ module.
NeighborSearch makes use of the Bio.KDTree C++ module, so it's fast.
"""
def __init__(self, atom_list, bucket_size=10):
"""
Expand Down
35 changes: 31 additions & 4 deletions Bio/PDB/PDBIO.py
Expand Up @@ -3,28 +3,55 @@
__doc__="Output of PDB files."


ATOM_FORMAT_STRING="%s%5i %-4s%c%3s %c%4i%c %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s\n"
_ATOM_FORMAT_STRING="%s%5i %-4s%c%3s %c%4i%c %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s\n"


class Select:
"""
Dummy class.
This selects which entities will be written out.
Default selection (everything) during writing - can be used as base class
to implement selective output. This selects which entities will be written out.
"""

def __repr__(self):
return "<Select all>"

def accept_model(self, model):
"""
Overload this to reject models for output.
"""
return 1

def accept_chain(self, chain):
"""
Overload this to reject chains for output.
"""
return 1

def accept_residue(self, residue):
"""
Overload this to reject residues for output.
"""
return 1

def accept_atom(self, atom):
"""
Overload this to reject atoms for output.
"""
return 1


class PDBIO:
"""
Write a Structure object (or a subset of a Structure object) as a PDB file.
Example:
>>> p=PDBParser()
>>> s=p.get_structure("1fat", "1fat.pdb")
>>> io=PDBIO()
>>> io.set_structure(s)
>>> io.save("out.pdb")
"""
def __init__(self):
pass

Expand All @@ -47,7 +74,7 @@ def _get_atom_line(self, atom, hetfield, segid, atom_number, resname,
args=(record_type, atom_number, name, altloc, resname, chain_id,
resseq, icode, x, y, z, occupancy, bfactor, segid,
element, charge)
return ATOM_FORMAT_STRING % args
return _ATOM_FORMAT_STRING % args

# Public methods

Expand Down
18 changes: 9 additions & 9 deletions Bio/PDB/Residue.py
Expand Up @@ -12,11 +12,11 @@
__doc__="Residue class, used by Structure objects."


atom_name_dict={}
atom_name_dict["N"]=1
atom_name_dict["CA"]=2
atom_name_dict["C"]=3
atom_name_dict["O"]=4
_atom_name_dict={}
_atom_name_dict["N"]=1
_atom_name_dict["CA"]=2
_atom_name_dict["C"]=3
_atom_name_dict["O"]=4


class Residue(Entity):
Expand Down Expand Up @@ -53,12 +53,12 @@ def _sort(self, a1, a2):
name2=a2.get_name()
if name1==name2:
return(cmp(a1.get_altloc(), a2.get_altloc()))
if atom_name_dict.has_key(name1):
index1=atom_name_dict[name1]
if _atom_name_dict.has_key(name1):
index1=_atom_name_dict[name1]
else:
index1=None
if atom_name_dict.has_key(name2):
index2=atom_name_dict[name2]
if _atom_name_dict.has_key(name2):
index2=_atom_name_dict[name2]
else:
index2=None
if index1 and index2:
Expand Down
8 changes: 7 additions & 1 deletion Bio/PDB/parse_pdb_header.py
Expand Up @@ -109,7 +109,13 @@ def _nice_case(line):
return s

def parse_pdb_header(file):
"""Returns the header lines for a pdb entry."""
"""
Returns the header lines of a pdb file as a dictionary.
Dictionary keys are: head, deposition_date, release_date, structure_method,
resolution, structure_reference, journal_reference, author and
compound.
"""
header=[]
f=open(filename,'r')
while f:
Expand Down

0 comments on commit e1b4434

Please sign in to comment.