def predict_peptides(self, peptides):
<EOL>from mhcflurry.encodable_sequences import EncodableSequences<EOL>binding_predictions = []<EOL>encodable_sequences = EncodableSequences.create(peptides)<EOL>for allele in self.alleles:<EOL><INDENT>predictions_df = self.predictor.predict_to_dataframe(<EOL>encodable_sequences, allele=allele)<EOL>for (_, row) in predictions_df.iterrows():<EOL><INDENT>binding_prediction = BindingPrediction(<EOL>allele=allele,<EOL>peptide=row.peptide,<EOL>affinity=row.prediction,<EOL>percentile_rank=(<EOL>row.prediction_percentile<EOL>if '<STR_LIT>' in row else nan),<EOL>prediction_method_name="<STR_LIT>"<EOL>)<EOL>binding_predictions.append(binding_prediction)<EOL><DEDENT><DEDENT>return BindingPredictionCollection(binding_predictions)<EOL>
Predict MHC affinity for peptides.