diff --git a/mhcflurry/predictor_base.py b/mhcflurry/predictor_base.py index 4b104049654730abccbbcf39bbc84327367b9d9b..1c6ed73a5aeedbaf1b174601dbfb7e061782e324 100644 --- a/mhcflurry/predictor_base.py +++ b/mhcflurry/predictor_base.py @@ -15,6 +15,7 @@ from collections import defaultdict import numpy as np +from six import string_types from .peptide_encoding import fixed_length_index_encoding from .amino_acid import ( @@ -114,6 +115,10 @@ class PredictorBase(object): amino acid characters. The prediction for a single peptide will be the average of expanded 9mers. """ + if isinstance(peptides, string_types): + raise TypeError("Input must be a list of peptides, not %s : %s" % ( + peptides, type(peptides))) + input_matrix, original_peptide_indices = self.encode_peptides(peptides) # non-9mer peptides get multiple predictions, which are then combined # with the combine_fn argument diff --git a/test/test_known_class1_epitopes.py b/test/test_known_class1_epitopes.py index 8b7ac11e0808395266f99c1bd73d2fc739c92041..face8d3ada3ae20414728cdd869601ca523aecff 100644 --- a/test/test_known_class1_epitopes.py +++ b/test/test_known_class1_epitopes.py @@ -1,3 +1,29 @@ -def test_known_class1_epitopes(): - pass +from mhcflurry import Class1BindingPredictor + +def test_MAGE_epitope(): + # Test the A1 MAGE epitope ESDPIVAQY from + # Identification of a Titin-Derived HLA-A1-Presented Peptide + # as a Cross-Reactive Target for Engineered MAGE A3-Directed + # T Cells + model = Class1BindingPredictor.from_allele_name("HLA-A*01:01") + ic50s = model.predict_peptides_ic50(["ESDPIVAQY"]) + print(ic50s) + assert len(ic50s) == 1 + ic50 = ic50s[0] + assert ic50 <= 500 + +def test_HIV_epitope(): + # Test the A2 HIV epitope SLYNTVATL from + # The HIV-1 HLA-A2-SLYNTVATL Is a Help-Independent CTL Epitope + model = Class1BindingPredictor.from_allele_name("HLA-A*02:01") + ic50s = model.predict_peptides_ic50(["SLYNTVATL"]) + print(ic50s) + assert len(ic50s) == 1 + ic50 = ic50s[0] + assert ic50 <= 500 + + +if __name__ == "__main__": + test_MAGE_epitope() + test_HIV_epitope()