How to use the mhcflurry.encodable_sequences.EncodableSequences function in mhcflurry

To help you get started, we’ve selected a few mhcflurry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openvax / mhctools / mhctools / mhcflurry.py View on Github external
def predict_peptides(self, peptides):
        """
        Predict MHC affinity for peptides.
        """

        # importing locally to avoid slowing down CLI applications which
        # don't use MHCflurry
        from mhcflurry.encodable_sequences import EncodableSequences

        binding_predictions = []
        encodable_sequences = EncodableSequences.create(peptides)
        for allele in self.alleles:
            predictions_df = self.predictor.predict_to_dataframe(
                encodable_sequences, allele=allele)
            for (_, row) in predictions_df.iterrows():
                binding_prediction = BindingPrediction(
                    allele=allele,
                    peptide=row.peptide,
                    affinity=row.prediction,
                    percentile_rank=(
                        row.prediction_percentile
                        if 'prediction_percentile' in row else nan),
                    prediction_method_name="mhcflurry")
                binding_predictions.append(binding_prediction)
        return BindingPredictionCollection(binding_predictions)

mhcflurry

MHC Binding Predictor

Apache-2.0
Latest version published 3 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages