Beispiel #1
0
    def microbe_enzproduction_rate(self, EnzGenes, EnzAttrib):
        """
        Derive the taxon-specific fraction of 'available C' as enzymes.

        This fraction only varies with taxon, which is independent of gene within a taxon
        
        Parameters:
            EnzGenes:         taxon-specific available genes for enzyme;dataframe (taxon * genes); from the above microbe_enzyme_gene() method
            EnzAttrib:        dataframe [enzyme * 4 (C,N,P,maintenence cost)]; basic enzyme stoichiometry
            Constit_Prod_min: min of constitutive enzyme production efficiency
            Constit_Prod_max: max of constitutive enzyme production efficiency
            Enz_Prod_min:     min of inducible enzyme production efficiency
            Enz_Prod_max:     max of inducible enzyme production efficiency
            NormalizeProd:    scalar; normalize enzyme production for the number of enzyme genes (0: No, 1: Yes)  
        Returns:
            Tax_EnzProdConsti:   series;    taxon-specific fraction of available C as enzyme for each taxon
            Tax_EnzProdInduce:   series;    taxon-specific fraction of available C as enzyme for each taxon
            Tax_Induce_Enzyme_C: dataframe; taxon-specific fraction of available C as enzyme for each enzyme
            Tax_Consti_Enzyme_C: dataframe; taxon-specific fraction of available C as enzyme for each enzyme
        """

        # LHS sampling of constitutive and inducible enzyme production efficiency for each taxon
        Tax_EnzProdConsti_array = LHS(self.n_taxa, self.Constit_Prod_min,
                                      self.Constit_Prod_max, 'uniform')
        Tax_EnzProdInduce_array = LHS(self.n_taxa, self.Enz_Prod_min,
                                      self.Enz_Prod_max, 'uniform')

        Tax_EnzProdConsti = pd.Series(data=Tax_EnzProdConsti_array,
                                      index=self.index,
                                      dtype='float32')
        Tax_EnzProdInduce = pd.Series(data=Tax_EnzProdInduce_array,
                                      index=self.index,
                                      dtype='float32')

        # Derive the production rate of every single gene of each taxon
        EnzProdConsti = EnzGenes.mul(Tax_EnzProdConsti, axis=0)
        EnzProdInduce = EnzGenes.mul(Tax_EnzProdInduce, axis=0)

        # Normalize constituitive and inducible enzyme production
        if self.NormalizeProd == 1:
            Normalize = EnzGenes.sum(axis=1) / self.Enz_per_taxon_max
            EnzProdConsti = EnzProdConsti.divide(Normalize, axis=0)
            EnzProdInduce = EnzProdInduce.divide(Normalize, axis=0)
            EnzProdConsti[Normalize == 0] = 0
            EnzProdInduce[Normalize == 0] = 0

        # Relative enzyme carbon cost for each enzyme gene of each taxon
        Tax_Consti_Enzyme_C = EnzProdConsti.mul(
            EnzAttrib["C_cost"], axis=1)  #C_cost = 1; so it doesn't matter
        Tax_Induce_Enzyme_C = EnzProdInduce.mul(EnzAttrib["C_cost"], axis=1)

        return Tax_EnzProdConsti, Tax_EnzProdInduce, Tax_Consti_Enzyme_C, Tax_Induce_Enzyme_C
Beispiel #2
0
    def microbe_uptake_cost(self, UptakeGenes):
        """
        Derive the taxon-specific cost of every single gene of uptake transporter.
        
        Note this cost (in terms of Fraction of Biomass C) is same among different genes from the same taxon
        
        Parameters:
            UptakeGenes:       dataframe; taxon-specific transporter genes; from the above method, microbe_uptake_gene()
            Uptake_C_cost_min: 0.01	transporter mg-1 biomass C
            Uptake_C_cost_max: 0.1	transporter mg-1 biomass C
            NormalizeUptake:   normalize uptake investment for the number of uptake genes (0: No, 1: Yes)
        Returns:
            UptakeProd_series: series; taxon-specific transporter cost
            UptakeGenes_Cost:  dataframe; taxon- and gene-specific transporter cost
        """

        # LHS sampling of transporter production efficiency for each taxon
        UptakeProd_array = LHS(self.n_taxa, self.Uptake_C_cost_min,
                               self.Uptake_C_cost_max, 'uniform')
        UptakeProd_series = pd.Series(data=UptakeProd_array,
                                      index=self.index,
                                      dtype='float32')

        # If true (== 1), then the uptake potential is normalized to the total number of uptake genes (n_uptake)
        if self.NormalizeUptake == 1:
            Normalize = UptakeGenes.sum(axis=1) / self.n_uptake
            UptakeGenes = UptakeGenes.divide(Normalize, axis=0)

        # Derive gene-specific production efficiency of each taxon
        UptakeGenes_Cost = UptakeGenes.mul(UptakeProd_series, axis=0)

        return UptakeProd_series, UptakeGenes_Cost
Beispiel #3
0
    def microbe_osmoproduction_rate(self, OsmoGenes):
        """
        Distribution of osmolyte production rate (i.e.,proportion of available C as osmolytes).

        Parameters:
            OsmoGenes:             dataframe(taxon*genes); generated by the above microbe_osmolyte_gene() method
            Osmo_Constit_Prod_min: min of constitutive osmolyte production efficiency
            Osmo_Constit_Prod_max: max of constitutive osmolyte production efficiency
            Osmo_Induci_Prod_min:  min of inducible osmolyte production efficiency
            Osmo_Induci_Prod_max:  max of inducible osmolyte production efficiency
            NormalizeProd:         0:No; 1:Yes   
        Returns:
            Tax_OsmoProd_Consti_series:
            Tax_OsmoProd_Induci_series:
            Tax_Consti_Osmo_C: taxon-specific fraction of available C as osmolytes for each gene
            Tax_Induce_Osmo_C: taxon-specific fraction of available C as osmolytes for each gene
        """

        # LHS sampling of osmolyte production efficiency for every taxon
        Tax_OsmoProd_Consti = LHS(self.n_taxa, self.Osmo_Consti_Prod_min,
                                  self.Osmo_Consti_Prod_max, 'uniform')
        Tax_OsmoProd_Induci = LHS(self.n_taxa, self.Osmo_Induci_Prod_min,
                                  self.Osmo_Induci_Prod_max, 'uniform')

        Tax_OsmoProd_Consti_series = pd.Series(data=Tax_OsmoProd_Consti,
                                               index=self.index,
                                               dtype='float32')
        Tax_OsmoProd_Induci_series = pd.Series(data=Tax_OsmoProd_Induci,
                                               index=self.index,
                                               dtype='float32')

        # Derive the production rate of every single gene of each taxon
        Tax_Consti_Osmo_C = OsmoGenes.mul(Tax_OsmoProd_Consti_series, axis=0)
        Tax_Induci_Osmo_C = OsmoGenes.mul(Tax_OsmoProd_Induci_series, axis=0)

        # Normalize constituitive and inducible osmolyte production
        if self.NormalizeProd == 1:
            Normalize = OsmoGenes.sum(axis=1) / self.Osmo_per_taxon_max
            Tax_Consti_Osmo_C = Tax_Consti_Osmo_C.divide(Normalize, axis=0)
            Tax_Induci_Osmo_C = Tax_Induci_Osmo_C.divide(Normalize, axis=0)
            Tax_Consti_Osmo_C[Normalize == 0] = 0
            Tax_Induci_Osmo_C[Normalize == 0] = 0

        return Tax_OsmoProd_Consti_series, Tax_OsmoProd_Induci_series, Tax_Consti_Osmo_C, Tax_Induci_Osmo_C
Beispiel #4
0
    def enzyme_Vmax(self, ReqEnz):
        """
        Pre-exponential constants for enzymes.
        
        Parameters:
          ReqEnz:        substrate required enzymes, from the substrate module
          Vmax0_min:     5  (mg substrate mg-1 enzyme day-1); Minimum Vmax for enzyme
          Vmax0_max:     50 (mg substrate mg-1 enzyme day-1); Maximum Vmax for enzyme
          Specif_factor: default 1; Efficiency-specificity   
        Returns:
          Vmax0:         dataframe(substrates * enzymes); feed the the method, enzyme_Km(), below
          Vmax0.T:       dataframe(enzyme*substrate); will feed the expand()
        """

        Vmax0_array = LHS(self.n_substrates * self.n_enzymes, self.Vmax0_min,
                          self.Vmax0_max, 'uniform')
        Vmax0_array = Vmax0_array.reshape(self.n_substrates, self.n_enzymes)
        columns = ['Enz' + str(i) for i in range(1, self.n_enzymes + 1)]
        Vmax0 = pd.DataFrame(data=Vmax0_array,
                             index=self.substrate_index,
                             columns=columns,
                             dtype='float32')

        # Account for efficiency-specificity tradeoff by dividing Vmax_0 by the number of substrates (or monomers)
        # targeted and multiplied by a specificity factor
        RE1 = ReqEnz.loc['set1'].iloc[range(self.n_substrates), :]
        RE2 = ReqEnz.loc['set2'].iloc[range(self.n_substrates), :]
        RE2 = RE2.fillna(0)

        # Total num. of substrates that each enzyme can target: series; indexed by enzyme
        total_substrates = RE1.sum(axis=0) + RE2.sum(axis=0)
        if self.Specif_factor == 0:
            total_substrates[total_substrates > 1] = 1
        else:
            total_substrates[total_substrates > 1] = total_substrates[
                total_substrates > 1] * self.Specif_factor

        Vmax0 = Vmax0.divide(total_substrates, axis=1)
        Vmax0.loc[:, total_substrates == 0] = 0  # get rid of NAs
        Vmax0 = Vmax0.astype('float32')

        return Vmax0, Vmax0.T
Beispiel #5
0
    def enzyme_uptake_Vmax(self, Uptake_ReqEnz):
        """
        Pre-exponential constants for uptake.
        
        Parameters:
            Uptake_ReqEnz:    uptake required enzymes; monomers * enzymes; from the monomer module
            Uptake_Vmax0_min: 1	(mg substrate mg-1 substrate day-1)	Minimum uptake Vmax
            Uptake_Vmax0_max: 10 (mg substrate mg-1 substrate day-1)	Maximum uptake Vmax
            Specif_factor:    default 1; Efficiency-specificity 
        Return:
            Uptake_Vmax0: dataframe; Rows are monomers; cols are uptake enzymes
        """

        #Uptake_Vmax0_array = np.random.uniform(self.Uptake_Vmax0_min,self.Uptake_Vmax0_max,self.n_uptake*self.n_monomers)
        Uptake_Vmax0_array = LHS(self.n_uptake * self.n_monomers,
                                 self.Uptake_Vmax0_min, self.Uptake_Vmax0_max,
                                 'uniform')
        Uptake_Vmax0_array = Uptake_Vmax0_array.reshape(
            self.n_monomers, self.n_uptake)

        index = ['Mon' + str(i) for i in range(1, self.n_monomers + 1)]
        columns = ['Upt' + str(i) for i in range(1, self.n_uptake + 1)]
        Uptake_Vmax0 = pd.DataFrame(data=Uptake_Vmax0_array,
                                    index=index,
                                    columns=columns,
                                    dtype='float32')

        # implement the tradeoff with specificity
        total_monomers = Uptake_ReqEnz.sum(axis=0)
        if self.Specif_factor == 0:
            total_monomers[total_monomers > 1] = 1
        else:
            total_monomers[total_monomers > 1] = total_monomers[
                total_monomers > 1] * self.Specif_factor
        Uptake_Vmax0 = Uptake_Vmax0.divide(total_monomers, axis=1)
        Uptake_Vmax0.loc[:, total_monomers == 0] = 0

        Uptake_Vmax0 = Uptake_Vmax0.astype('float32')

        return Uptake_Vmax0