当前位置: 首页>>代码示例>>Python>>正文


Python pymc.Uniform方法代码示例

本文整理汇总了Python中pymc.Uniform方法的典型用法代码示例。如果您正苦于以下问题:Python pymc.Uniform方法的具体用法?Python pymc.Uniform怎么用?Python pymc.Uniform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymc的用法示例。


在下文中一共展示了pymc.Uniform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_competitive_binding_model

# 需要导入模块: import pymc [as 别名]
# 或者: from pymc import Uniform [as 别名]
def _create_competitive_binding_model(self, receptor_name, DeltaG_prior):
        """
        Create the binding free energy priors, binding reaction models, and list of all species whose concentrations will be tracked.

        Populates the following fields:
        * parameter_names['DeltaGs'] : parameters associated with DeltaG priors
        * reactions : reactions for GeneralBindingModel with DeltaG parameters substituted for free energies
          formatted like [ ('DeltaG1', {'RL': -1, 'R' : +1, 'L' : +1}), ('DeltaG2', {'RP' : -1, 'R' : +1, 'P' : +1}) ]
        * conservation_equations : conservation relationships for GeneralBindingModel with species names substituted with log concentrations
          formatted like [ ('receptor', {'receptor' : +1, 'receptor:ligand' : +1}), ('ligand' : {'receptor:ligand' : +1, 'ligand' : +1}) ]
        * complex_names : names of all complexes
        * all_species : names of all species (ligands, receptor, complexes)
        """
        self.parameter_names['binding affinities'] = list()
        self.complex_names = list()
        self.reactions = list() # reactions for GeneralBindingModel with pymc parameters substituted for free energies
        self.conservation_equations = list() # list of conservation relationships for GeneralBindingModel with pymc parameters substituted for log concentrations
        receptor_conservation_equation = { receptor_name : +1 } # Begin to populate receptor conservation equation
        for ligand_name in self.ligand_names:
            # Create complex name
            complex_name = receptor_name + ':' + ligand_name
            self.complex_names.append(complex_name)
            # Create the DeltaG prior
            name = 'DeltaG (%s + %s -> %s)' % (receptor_name, ligand_name, complex_name) # form the name of the pymc variable
            if DeltaG_prior == 'uniform':
                DeltaG = pymc.Uniform(name, lower=DG_min, upper=DG_max) # binding free energy (kT), uniform over huge range
            elif DeltaG_prior == 'chembl':
                DeltaG = pymc.Normal(name, mu=0, tau=1./(12.5**2)) # binding free energy (kT), using a Gaussian prior inspured by ChEMBL
            else:
                raise Exception("DeltaG_prior = '%s' unknown. Must be one of 'uniform' or 'chembl'." % DeltaG_prior)
            self.model[name] = DeltaG
            self.parameter_names['binding affinities'].append(name)
            # Create the reaction for GeneralBindingModel
            self.reactions.append( (DeltaG, {complex_name : -1, receptor_name : +1, ligand_name : +1}) )
            # Create the conservation equation for GeneralBindingModel
            self.conservation_equations.append( (ligand_name, {ligand_name : +1, complex_name : +1}) )
            # Keep track of receptor conservation.
            receptor_conservation_equation[complex_name] = +1
        # Create the receptor conservation equation for GeneralBindingModel
        self.conservation_equations.append( [receptor_name, receptor_conservation_equation] )

        # Create a list of all species that may be present in assay plate
        self.all_species = [self.receptor_name] + self.ligand_names + self.complex_names 
开发者ID:choderalab,项目名称:assaytools,代码行数:45,代码来源:analysis.py

示例2: _create_extinction_coefficients_model

# 需要导入模块: import pymc [as 别名]
# 或者: from pymc import Uniform [as 别名]
def _create_extinction_coefficients_model(self):
        """
        Determine all spectroscopic wavelengths in use and create model of extinction coefficients

        Populates the following fields:
        * parameter_names['extinction coefficients'] : all extinction coefficients
        * all_wavelengths : list of all wavelengths in use
        * absorbance : True if absorbance in use
        * fluorescence : True if fluorescence in use

        """
        #
        # Spectroscopic measurements
        #

        # TODO: Switch to log extinction coefficients and uniform prior in log extinction coefficients
        MIN_EXTINCTION_COEFFICIENT = Unit(0.1, '1/(moles/liter)/centimeter') # maximum physically reasonable extinction coefficient
        MAX_EXTINCTION_COEFFICIENT = Unit(100e3, '1/(moles/liter)/centimeter') # maximum physically reasonable extinction coefficient
        EXTINCTION_COEFFICIENT_GUESS = Unit(1.0, '1/(moles/liter)/centimeter') # maximum physically reasonable extinction coefficient

        # Determine all wavelengths and detection technologies in use
        self.all_wavelengths = set()
        for well in self.wells:
            measurements = well.properties['measurements']
            if 'absorbance' in measurements:
                for wavelength in measurements['absorbance'].keys():
                    self.all_wavelengths.add(wavelength)
            if 'fluorescence' in measurements:
                for (excitation_wavelength, emission_wavelength, geometry) in measurements['fluorescence'].keys():
                    self.all_wavelengths.add(excitation_wavelength)
                    self.all_wavelengths.add(emission_wavelength)
        print("all wavelengths in use:")
        print(self.all_wavelengths)

        if (len(self.all_wavelengths) > 0):
            # Priors for spectroscopic parameters of each component
            self.parameter_names['extinction coefficients'] = list()
            for species in self.all_species:
                for wavelength in self.all_wavelengths:
                    name = 'log extinction coefficient of %s at wavelength %s' % (species, wavelength)
                    log_extinction_coefficient = pymc.Uniform(name, lower=np.log(MIN_EXTINCTION_COEFFICIENT.to_base_units().m), upper=np.log(MAX_EXTINCTION_COEFFICIENT.to_base_units().m), value=np.log(EXTINCTION_COEFFICIENT_GUESS.to_base_units().m)) # extinction coefficient or molar absorptivity for ligand, units of 1/M/cm
                    self.model[name] = log_extinction_coefficient
                    self.parameter_names['extinction coefficients'].append(name) 
开发者ID:choderalab,项目名称:assaytools,代码行数:45,代码来源:analysis.py


注:本文中的pymc.Uniform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。