# Path: PyContact/db/DbReader.py
# def read_residue_db(selection, key, value):
#     connection = sqlite3.connect(os.path.dirname(os.path.abspath(__file__)) + "/aa.db")
#     connection.row_factory = dict_factory
#     cursor = connection.cursor()
#     cursor.execute("SELECT ({sel}) FROM residues WHERE {key}=\'{value}\'".format(sel=selection, key=key, value=value))
#     results = cursor.fetchall()
#     connection.close()
#     return results


import collections
import numpy as np
from ..db.DbReader import read_residue_db
            i += 1
        return lifeTimes

    def hbondFramesScan(self):
        self.hbondFrames = []
        for frameList in self.contributingAtoms:
            currentFrame = 0
            for contAtoms in frameList:
                length = len(contAtoms.hbondinfo)
                if length > 0:
                    currentFrame += length
            self.hbondFrames.append(currentFrame)
        return self.hbondFrames

    def setContactType(self):
        self.contactType = self.determine_ctype()

    def contactTypeAsShortcut(self):
        return ContactType.shortcut[self.determine_ctype()]

    def determine_ctype(self):
        """Computes the contact type of the accumulated contacts."""

        # only works if both maps contain resname
        r1 = self.key1[AccumulationMapIndex.resname].lower()
        r2 = self.key2[AccumulationMapIndex.resname].lower()
        # if r1 == "none" or r2 == "none":
        #     return ContactType.other
        self.determineBackboneSidechainType()
        try:

# Path: PyContact/db/DbReader.py
# def read_residue_db(selection, key, value):
#     connection = sqlite3.connect(os.path.dirname(os.path.abspath(__file__)) + "/aa.db")
#     connection.row_factory = dict_factory
#     cursor = connection.cursor()
#     cursor.execute("SELECT ({sel}) FROM residues WHERE {key}=\'{value}\'".format(sel=selection, key=key, value=value))
#     results = cursor.fetchall()
#     connection.close()
#     return results


# Path: PyContact/core/Biochemistry.py
import collections
import numpy as np
from ..db.DbReader import read_residue_db

            i += 1
        return lifeTimes

    def hbondFramesScan(self):
        self.hbondFrames = []
        for frameList in self.contributingAtoms:
            currentFrame = 0
            for contAtoms in frameList:
                length = len(contAtoms.hbondinfo)
                if length > 0:
                    currentFrame += length
            self.hbondFrames.append(currentFrame)
        return self.hbondFrames

    def setContactType(self):
        self.contactType = self.determine_ctype()

    def contactTypeAsShortcut(self):
        return ContactType.shortcut[self.determine_ctype()]

    def determine_ctype(self):
        """Computes the contact type of the accumulated contacts."""

        # only works if both maps contain resname
        r1 = self.key1[AccumulationMapIndex.resname].lower()
        r2 = self.key2[AccumulationMapIndex.resname].lower()
        # if r1 == "none" or r2 == "none":
        #     return ContactType.other
        self.determineBackboneSidechainType()
        try:

            sc1 = str(read_residue_db("scpolarity", "name", r1)[0]["scpolarity"])