def add_binding_prediction(
            self,
            source_sequence_key,
            offset,
            peptide,
            allele,
            ic50,
            rank,
            log_ic50=None):
        # if we have a bad IC50 score we might still get a salvageable
        # log of the score. Strangely, this is necessary sometimes!
        if invalid_binding_score(ic50) and log_ic50 is not None:
            ic50 = 50000 ** (-log_ic50 + 1)
        # if IC50 is still NaN or otherwise invalid, abort
        if invalid_binding_score(ic50):
            raise ValueError(
                "Invalid IC50 value %0.4f for %s w/ allele %s" % (
                    ic50,
                    peptide,
                    allele))

        if invalid_binding_score(rank) or rank > 100:
            raise ValueError(
                "Invalid percentile rank %s for %s w/ allele %s" % (
                    rank, peptide, allele))

        if source_sequence_key not in self.fasta_dictionary:
            raise ValueError("Sequence identifier %s not found in %s" % (
                source_sequence_key, self.fasta_dictionary))

        source_sequence = str(self.fasta_dictionary[source_sequence_key])

        binding_prediction = BindingPrediction(
            source_sequence_key=source_sequence_key,
            source_sequence=source_sequence,
            offset=offset,
            allele=normalize_allele_name(allele),
            peptide=peptide,
            length=len(peptide),
            value=ic50,
            percentile_rank=rank,
            prediction_method_name=self.prediction_method_name,
            measure=self.binding_measure)
        self.binding_predictions.append(binding_prediction)
Parameters
dataset/ETHPy150Open hammerlab/mhctools/mhctools/epitope_collection_builder.py/EpitopeCollectionBuilder.add_binding_prediction