Example #1
0
    def __add__(self, other):
        df = DataFrame(columns=["knockouts", "knock_ins", "over_expression", "down_regulation", "type", "method"])
        i = 0
        for i, design in enumerate(self):
            df.loc[i] = list(design) + [design.manipulation_type, self._methods]

        for j, design in enumerate(other):
            if isinstance(other, StrainDesignEnsemble):
                df.loc[i + j] = list(design) + [design.manipulation_type, self._methods]
            else:
                df.loc[i + j] = list(design) + [design.manipulation_type, [self.__method_name__]]

        df = df.groupby(["knockouts", "knock_ins",
                         "over_expression", "down_regulation", "type"]).aggregate(self._aggreate_functions_)

        designs = [StrainDesign(row.values[:-1]) for _, row in df.iterrows()]

        return StrainDesignEnsemble(designs, df['method'].tolist())
Example #2
0
    def __add__(self, other):
        df = DataFrame([design.targets for design in self._designs], columns=["targets"])
        df['method'] = self.__method_name__

        i = len(df)
        for j, design in enumerate(other):
            df.loc[i + j] = [design, [self.__method_name__]]

        df = df.groupby(["design"]).aggregate(self._aggreate_functions_)

        return StrainDesignMethodEnsemble([StrainDesign(targets) for targets in df.targets], df.method.tolist())
Example #3
0
    def __add__(self, other):
        df = DataFrame(columns=["knockouts", "knock_ins", "over_expression", "down_regulation", "type", "method"])
        i = 0
        for i, design in enumerate(self):
            df.loc[i] = list(design) + [design.manipulation_type, [self.__method_name__]]

        for j, design in enumerate(other):
            df.loc[i + j] = list(design) + [design.manipulation_type, [self.__method_name__]]

        df = df.groupby(["knockouts", "knock_ins",
                         "over_expression", "down_regulation", "type"]).aggregate(self._aggreate_functions_)

        return StrainDesignEnsemble(df.index.tolist(), df['method'].tolist())