Skip to content
Snippets Groups Projects
Commit 7a54300b authored by Tim O'Donnell's avatar Tim O'Donnell
Browse files

truncate huge error message when missing an allele in the pan-allele predictor

parent 8a2bbbf9
No related merge requests found
...@@ -1079,11 +1079,16 @@ class Class1AffinityPredictor(object): ...@@ -1079,11 +1079,16 @@ class Class1AffinityPredictor(object):
if allele not in self.allele_to_sequence if allele not in self.allele_to_sequence
] ]
if unsupported_alleles: if unsupported_alleles:
truncate_at = 100
allele_string = " ".join(
sorted(self.allele_to_sequence)[:truncate_at])
if len(self.allele_to_sequence) > truncate_at:
allele_string += " + %d more alleles" % (
len(self.allele_to_sequence) - truncate_at)
msg = ( msg = (
"No sequences for allele(s): %s.\n" "No sequences for allele(s): %s.\n"
"Supported alleles: %s" % ( "Supported alleles: %s" % (
" ".join(unsupported_alleles), " ".join(unsupported_alleles), allele_string))
" ".join(sorted(self.allele_to_sequence))))
logging.warning(msg) logging.warning(msg)
if throw: if throw:
raise ValueError(msg) raise ValueError(msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment