Example #1
0
    def get_optimem_dilution_factor_from_molecule_type(cls, molecule_type):
        """
        Returns the optimem dilution factor for a molecule type or molecule
        type name.

        :param molecule_type: The molecule types for the molecule design pool.
        :type molecule_type: :class:`thelma.entities.moleculetype.MoleculeType`
            or :class:`str` (molecule type ID)
        :raises TypeError: For molecule types of the wrong class.
        :raises ValueError: If the molecule type is unknown.
        :return: The OptiMem dilution factor for this molecule type.
        """
        if isinstance(molecule_type, MoleculeType):
            mt_id = molecule_type.id
        elif isinstance(molecule_type, basestring):
            if MOLECULE_TYPE_IDS.is_known_type(molecule_type):
                mt_id = molecule_type
            else:
                msg = 'Unknown molecule type name "%s".' % (molecule_type)
                raise ValueError(msg)
        else:
            msg = 'The molecule types must be a %s object or a string ' \
                  '(obtained: %s).' % (MoleculeType.__class__.__name__,
                   molecule_type.__class__.__name__)
            raise TypeError(msg)

        if mt_id == MOLECULE_TYPE_IDS.MIRNA_INHI or \
                                    mt_id == MOLECULE_TYPE_IDS.MIRNA_MIMI:
            return cls.MIRNA_OPTIMEM_DILUTION_FACTOR
        else:
            return cls.STANDARD_OPTIMEM_DILUTION_FACTOR
Example #2
0
    def get_optimem_dilution_factor_from_molecule_type(cls, molecule_type):
        """
        Returns the optimem dilution factor for a molecule type or molecule
        type name.

        :param molecule_type: The molecule types for the molecule design pool.
        :type molecule_type: :class:`thelma.entities.moleculetype.MoleculeType`
            or :class:`str` (molecule type ID)
        :raises TypeError: For molecule types of the wrong class.
        :raises ValueError: If the molecule type is unknown.
        :return: The OptiMem dilution factor for this molecule type.
        """
        if isinstance(molecule_type, MoleculeType):
            mt_id = molecule_type.id
        elif isinstance(molecule_type, basestring):
            if MOLECULE_TYPE_IDS.is_known_type(molecule_type):
                mt_id = molecule_type
            else:
                msg = 'Unknown molecule type name "%s".' % (molecule_type)
                raise ValueError(msg)
        else:
            msg = 'The molecule types must be a %s object or a string ' \
                  '(obtained: %s).' % (MoleculeType.__class__.__name__,
                   molecule_type.__class__.__name__)
            raise TypeError(msg)

        if mt_id == MOLECULE_TYPE_IDS.MIRNA_INHI or \
                                    mt_id == MOLECULE_TYPE_IDS.MIRNA_MIMI:
            return cls.MIRNA_OPTIMEM_DILUTION_FACTOR
        else:
            return cls.STANDARD_OPTIMEM_DILUTION_FACTOR
Example #3
0
    def from_molecule_type(cls, molecule_type, number_designs=1):
        """
        Returns the stock concentration for the given molecule type.

        :param molecule_type: The molecule types whose stock concentration
            you want to know.
        :type molecule_type: :class:`thelma.entities.moleculetype.MoleculeType`
            or :class:`str` (molecule type ID)

        :param number_designs: The number of designs in a pool (at the moment
            this is only makes a difference for siRNA pools).
        :type number_designs: positive integer
        :default number_designs: 1

        :raises TypeError: For molecule types of the wrong class.
        :raises ValueError: If the molecule type is unknown.
        :return: The stock concentration for that molecule type in nM.
        """

        if isinstance(molecule_type, MoleculeType):
            mt_id = molecule_type.id
        elif isinstance(molecule_type, basestring):
            if MOLECULE_TYPE_IDS.is_known_type(molecule_type):
                mt_id = molecule_type
            else:
                msg = 'Unknown molecule type name "%s".' % (molecule_type)
                raise ValueError(msg)
        else:
            msg = 'The molecule types must be a %s object or a string ' \
                  '(obtained: %s).' % (MoleculeType.__class__.__name__,
                   molecule_type.__class__.__name__)
            raise TypeError(msg)

        if mt_id == MOLECULE_TYPE_IDS.MIRNA_INHI or \
                                     mt_id == MOLECULE_TYPE_IDS.MIRNA_MIMI:
            return cls._MICRO_RNA_STOCK_CONCENTRATION
        elif mt_id == MOLECULE_TYPE_IDS.ESI_RNA:
            return cls._ESI_RNA_STOCK_CONCENTRATION
        elif mt_id == MOLECULE_TYPE_IDS.COMPOUND:
            return cls.COMPOUND_STOCK_CONCENTRATION
        elif mt_id == MOLECULE_TYPE_IDS.SIRNA and number_designs > 1:
            return  cls._SIRNA_POOL_CONCENTRATION
        else:
            return cls._STANDARD_STOCK_CONCENTRATION