# 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)


import os, sys
from .helper import geometry

# 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_contact.py

Generate a distance-based contact plot for a protein.
"""

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


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]


# 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
import os, sys
from .helper import geometry


# 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_contact.py

Generate a distance-based contact plot for a protein.
"""

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


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)