How to use the mdanalysis.AccumulationMapIndex.mapping function in MDAnalysis

To help you get started, we’ve selected a few MDAnalysis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maxscheurer / pycontact / mdanalysis.py View on Github external
def makeKeyArraysFromKey(self,key):
        keystring1, keystring2 = key.split("-")
        mapping = AccumulationMapIndex.mapping
        maximal = len(mapping)
        key1 = []
        for i in range(0, maximal):
            current = mapping[i]
            if current not in keystring1:
                key1.append("none")
                continue
            if i == (maximal - 1):
                key1.append(keystring1[keystring1.index(current) + len(current):])
                break
            nextCurrent = mapping[i + 1]
            if nextCurrent not in keystring1:
                nxt = ""
                for k in mapping[i + 1:]:
                    if k in keystring1[keystring1.index(current) + len(current):]:
                        nxt = k
github maxscheurer / pycontact / mdanalysis.py View on Github external
def makeKeyFromKeyArrays(self,key1, key2):
        key = ""
        itemcounter = 0
        for item in key1:
            if item != "none":
                key += AccumulationMapIndex.mapping[itemcounter] + str(item)
            itemcounter += 1
        key += "-"
        itemcounter = 0
        for item in key2:
            if item != "none":
                key += AccumulationMapIndex.mapping[itemcounter] + str(item)
            itemcounter += 1
        return key
github maxscheurer / pycontact / mdanalysis.py View on Github external
def human_readable_title(self):
        total = []
        for key in [self.key1, self.key2]:
            titleDict = {}
            counter = 0
            for item in key:
                titleDict[AccumulationMapIndex.mapping[counter]] = (item if item != "none" else "")
                counter += 1
            residueString = "%s%s" % (titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.resname]],
                                      str(titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.resid]]))
            atomIndexString = ("%s %s" % (AccumulationMapIndex.mapping[AccumulationMapIndex.index],
                                          str(titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.index]])) if
                               titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.index]] != "" else "")
            atomNameString = ("%s %s" % (AccumulationMapIndex.mapping[AccumulationMapIndex.name],
                                         str(titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.name]])) if
                              titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.name]] != "" else "")
            segnameString = ("%s %s" % (AccumulationMapIndex.mapping[AccumulationMapIndex.segid],
                                        str(titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.segid]])) if
                             titleDict[AccumulationMapIndex.mapping[AccumulationMapIndex.segid]] != "" else "")
            list = [residueString, atomIndexString, atomNameString, segnameString]
            finishedList = []
            for string in list:
                if string != "":
                    finishedList.append(string)
            finishedString = " , ".join(finishedList)