コード例 #1
0
    def saveIndexTree(self, supertreeSplits, supertreeDict):
        for key, value in supertreeDict.items():
            inter = Intersection(supertreeSplits[key][0],
                                 supertreeSplits[key][1], 0, 0)
            if self.doStandardDecoration:
                self.csvValues.append([
                    key,
                    int(round(100.0 * (value[0] / self.T))),
                    int(round(100.0 * (value[1] / self.T))),
                    int(round(100.0 * (value[2] / self.T))),
                    int(round(100.0 * (value[3] / self.T))),
                    int(round(100.0 * (value[4] / self.T))),
                    int(round(100.0 * (value[5] / self.T))), value[6],
                    value[7], value[8], value[9], value[10], value[11]
                ])
            else:
                self.csvValues.append([
                    key, value[0] + value[1], value[0], value[1], value[2],
                    value[3], value[4], value[5], value[6], value[7], value[8],
                    value[9], value[10], value[11]
                ])
            inter.name = str(key)
            self.indexIntersections.append(inter)

        treeBuilderFromSplits = TreeBuilderFromSplits(self.bitkeys,
                                                      self.taxnames)

        self.indexSuperTree = treeBuilderFromSplits.buildTreeFromInformativeList(
            self.indexIntersections, treeName='indexSupertree')

        self.indexSuperTree.writeNexus(self.indexFilename)

        writer = csv.writer(open(self.csvFilename, "wb"))

        writer.writerows(self.csvValues)
コード例 #2
0
    def saveIndexTree(self, supertreeSplits, supertreeDict):
        for key, value in supertreeDict.items():
            inter = Intersection(supertreeSplits[key][0], supertreeSplits[key][1], 0, 0)
            if self.doStandardDecoration:
                self.csvValues.append(
                    [
                        key,
                        int(round(100.0 * (value[0] / self.T))),
                        int(round(100.0 * (value[1] / self.T))),
                        int(round(100.0 * (value[2] / self.T))),
                        int(round(100.0 * (value[3] / self.T))),
                        int(round(100.0 * (value[4] / self.T))),
                        int(round(100.0 * (value[5] / self.T))),
                        value[6],
                        value[7],
                        value[8],
                        value[9],
                        value[10],
                        value[11],
                    ]
                )
            else:
                self.csvValues.append(
                    [
                        key,
                        value[0] + value[1],
                        value[0],
                        value[1],
                        value[2],
                        value[3],
                        value[4],
                        value[5],
                        value[6],
                        value[7],
                        value[8],
                        value[9],
                        value[10],
                        value[11],
                    ]
                )
            inter.name = str(key)
            self.indexIntersections.append(inter)

        treeBuilderFromSplits = TreeBuilderFromSplits(self.bitkeys, self.taxnames)

        self.indexSuperTree = treeBuilderFromSplits.buildTreeFromInformativeList(
            self.indexIntersections, treeName="indexSupertree"
        )

        self.indexSuperTree.writeNexus(self.indexFilename)

        writer = csv.writer(open(self.csvFilename, "wb"))

        writer.writerows(self.csvValues)
コード例 #3
0
    def buildDecoratedTree(self, supertreeSplits, supertreeDict):

        for key, value in supertreeDict.items():
            inter = Intersection(supertreeSplits[key][0], supertreeSplits[key][1], 0, 0)
            name = ""
            if self.doStandardDecoration:
                name = str(int(round(100.0 * (1.0 + value[9]) / 2.0)))
            else:
                name = str(value[9])
            inter.name = name
            self.intersections.append(inter)

        treeBuilderFromSplits = TreeBuilderFromSplits(self.bitkeys, self.taxnames)

        self.decoratedSuperTree = treeBuilderFromSplits.buildTreeFromInformativeList(
            self.intersections, treeName="decoratedSupertree"
        )
コード例 #4
0
    def buildDecoratedTree(self, supertreeSplits, supertreeDict):

        for key, value in supertreeDict.items():
            inter = Intersection(supertreeSplits[key][0],
                                 supertreeSplits[key][1], 0, 0)
            name = ''
            if self.doStandardDecoration:
                name = str(int(round(100.0 * (1.0 + value[9]) / 2.0)))
            else:
                name = str(value[9])
            inter.name = name
            self.intersections.append(inter)

        treeBuilderFromSplits = TreeBuilderFromSplits(self.bitkeys,
                                                      self.taxnames)

        self.decoratedSuperTree = treeBuilderFromSplits.buildTreeFromInformativeList(
            self.intersections, treeName='decoratedSupertree')