예제 #1
0
파일: UPGMA.py 프로젝트: KurSh/netzob
    def processUPGMA(self):
        self.log.debug("Computing the associated matrix")

        # Serialize the symbols
        (serialSymbols, formatSymbols) = TypeConvertor.serializeSymbols(self.symbols, self.unitSize, self.scores)
        self.log.debug("Clustering input format " + formatSymbols)

        # Execute the Clustering part in C
        debug = False
        logging.debug("Execute the clustering part in C ...")
        (i_max, j_max, maxScore, scores) = _libNeedleman.getHighestEquivalentGroup(self.doInternalSlick, len(self.symbols), formatSymbols, serialSymbols, self.cb_executionStatus, debug)
        listScores = TypeConvertor.deserializeScores(self.symbols, scores)

        # Retrieve the scores for each association of symbols
        self.scores = {}
        for (iuid, juid, score) in listScores:
            if iuid not in self.scores.keys():
                self.scores[iuid] = {}
            if juid not in self.scores.keys():
                self.scores[juid] = {}
            self.scores[iuid][juid] = score
            if iuid not in self.scores[juid].keys():
                self.scores[juid][iuid] = score

        # Reduce the UPGMA matrix (merge symbols by similarity)
        self.computePhylogenicTree()
        return (i_max, j_max, maxScore)
예제 #2
0
파일: UPGMA.py 프로젝트: KurSh/netzob
    def deserializeGroups(self, symbols):
        # First we serialize the messages
        (serialSymbols, format) = TypeConvertor.serializeSymbols(symbols, self.unitSize, self.scores)

        debug = False
        return _libNeedleman.deserializeGroups(len(symbols), format, serialSymbols, debug)