Exemplo n.º 1
0
    def row_from_item(setting):
        """ Get a row to be displayed in the table

        Parameters
        ----------
        setting : GEMEditor.data_classes.ReactionSetting

        Returns
        -------
        list
        """
        reaction_item = LinkedItem(setting.reaction.id, setting.reaction)
        reaction_item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        upper_bound_item = QStandardItem()
        upper_bound_item.setData(setting.upper_bound, 2)

        lower_bound_item = QStandardItem()
        lower_bound_item.setData(setting.lower_bound, 2)

        objective_item = QStandardItem()
        objective_item.setData(setting.objective_coefficient, 2)

        return [
            reaction_item, lower_bound_item, upper_bound_item, objective_item
        ]
Exemplo n.º 2
0
    def row_from_item(setting):
        """ Get a row to be displayed in the table

        Parameters
        ----------
        setting : GEMEditor.data_classes.GeneSetting

        Returns
        -------
        list
        """
        gene_item = LinkedItem(setting.gene.id, setting.gene)
        gene_item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        if setting.activity is True:
            state = "active"
        elif setting.activity is False:
            state = "inactive"
        else:
            raise ValueError("Unknown state '{}' for gene activity.".format(
                str(setting.gene.functional)))

        activity_item = QStandardItem(state)

        return [gene_item, activity_item]
Exemplo n.º 3
0
    def row_from_item(outcome):
        reaction_item = LinkedItem(outcome.reaction.id, outcome.reaction)
        reaction_item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        operator_item = QStandardItem(outcome.operator)

        flux_value_item = QStandardItem()
        flux_value_item.setData(outcome.value, 2)

        return [reaction_item, operator_item, flux_value_item]
Exemplo n.º 4
0
 def row_from_item(input_tuple):
     """ Return the table row from an input item """
     metabolite, stoichiometry = input_tuple
     id_item = LinkedItem(metabolite.id, metabolite)
     id_item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
     id_item.setToolTip("Formula: {}\nCharge: {}".format(
         metabolite.formula, metabolite.charge))
     value_item = LinkedItem(link=metabolite)
     value_item.setData(stoichiometry, 2)
     return [id_item, value_item]