# Path: pdbtools/helper/geometry.py
# def dist(c1,c2=[0.,0.,0.]):
# def dist_sq(c1,c2=[0.,0.,0.]):
# def calcDistances(coord):
# def crossProduct(u,v):
# def dotProduct(u,v):
# def findAngle(u,v):
# def genRotMatrix(axis,theta):
# def arbRot(vector,axis,theta):
# def arbRotCoord(coord,axis,theta):
# def calcGlyCbeta(Ncoord,CAcoord,COcoord):
# def calcHXT(C_coord,O_coord,OXT_coord):
# def calcHG(CB_coord,SG_coord):
# def calcDihedrals(prevCO,currN,currCA,currCO,nextN,cutoff=6.5):
# def calcHN(prevCO,prevO,currN,currCA):
#     A = [prevCO[i] - currCA[i] for i in range(3)]
#     B = [currN[i] - currCA[i] for i in range(3)]
#     C = [currCO[i] - currCA[i] for i in range(3)]
#     D = [nextN[i] - currCA[i] for i in range(3)]
#     V1 = crossProduct(A,B)
#     V2 = crossProduct(C,B)
#     V3 = crossProduct(C,D)
# 
# Path: pdbtools/contactplot.py
# def pdbContact(pdb,all=False):
#     """
#     Generate array of all atom-atom distances in a pdb file.  Defaults to only
#     look at CA atoms
#     """
# 
#     # Remove non-CA atoms
#     if not all:
#         pdb = [l for l in pdb if l[0:4] == "ATOM" and l[13:16] == "CA "]
#     else:
#         pdb = [l for l in pdb if l[0:4] == "ATOM"]
# 
#     coord = [[float(l[30+8*i:38+8*i]) for i in range(3)] for l in pdb]
# 
#     dist = geometry.calcDistances(coord)
# 
#     return dist


import os, sys
from .helper import geometry
from .contactplot import pdbContact
#!/usr/bin/env python

# Copyright 2007, Michael J. Harms
# This program is distributed under General Public License v. 3.  See the file
# COPYING for a copy of the license.

__description__ = \
"""
pdb_close-contacts.py

Create a list of atoms that are within some distance cutoff of each other in
a pdb file.
"""

__author__ = "Michael J. Harms"
__date__ = ""


def pdbCloseContacts(pdb,ca_only,distance_cutoff):
    """
    Return a list of atom-atom distances that are less than distance_cutoff.
    It ignores atom-atom distances within a given residue.  If ca_only is True,
    it will only look at CA atoms.
    """

    pdb = [l for l in pdb if l[:4] == "ATOM"]


# Path: pdbtools/helper/geometry.py
# def dist(c1,c2=[0.,0.,0.]):
# def dist_sq(c1,c2=[0.,0.,0.]):
# def calcDistances(coord):
# def crossProduct(u,v):
# def dotProduct(u,v):
# def findAngle(u,v):
# def genRotMatrix(axis,theta):
# def arbRot(vector,axis,theta):
# def arbRotCoord(coord,axis,theta):
# def calcGlyCbeta(Ncoord,CAcoord,COcoord):
# def calcHXT(C_coord,O_coord,OXT_coord):
# def calcHG(CB_coord,SG_coord):
# def calcDihedrals(prevCO,currN,currCA,currCO,nextN,cutoff=6.5):
# def calcHN(prevCO,prevO,currN,currCA):
#     A = [prevCO[i] - currCA[i] for i in range(3)]
#     B = [currN[i] - currCA[i] for i in range(3)]
#     C = [currCO[i] - currCA[i] for i in range(3)]
#     D = [nextN[i] - currCA[i] for i in range(3)]
#     V1 = crossProduct(A,B)
#     V2 = crossProduct(C,B)
#     V3 = crossProduct(C,D)
# 
# Path: pdbtools/contactplot.py
# def pdbContact(pdb,all=False):
#     """
#     Generate array of all atom-atom distances in a pdb file.  Defaults to only
#     look at CA atoms
#     """
# 
#     # Remove non-CA atoms
#     if not all:
#         pdb = [l for l in pdb if l[0:4] == "ATOM" and l[13:16] == "CA "]
#     else:
#         pdb = [l for l in pdb if l[0:4] == "ATOM"]
# 
#     coord = [[float(l[30+8*i:38+8*i]) for i in range(3)] for l in pdb]
# 
#     dist = geometry.calcDistances(coord)
# 
#     return dist


# Path: pdbtools/closecontacts.py
import os, sys
from .helper import geometry
from .contactplot import pdbContact

#!/usr/bin/env python

# Copyright 2007, Michael J. Harms
# This program is distributed under General Public License v. 3.  See the file
# COPYING for a copy of the license.

__description__ = \
"""
pdb_close-contacts.py

Create a list of atoms that are within some distance cutoff of each other in
a pdb file.
"""

__author__ = "Michael J. Harms"
__date__ = ""


def pdbCloseContacts(pdb,ca_only,distance_cutoff):
    """
    Return a list of atom-atom distances that are less than distance_cutoff.
    It ignores atom-atom distances within a given residue.  If ca_only is True,
    it will only look at CA atoms.
    """

    pdb = [l for l in pdb if l[:4] == "ATOM"]


    distances = pdbContact(pdb,not ca_only)