diff --git a/mhcflurry/select_allele_specific_models_command.py b/mhcflurry/select_allele_specific_models_command.py
index ef947715c07b8ca74288f13e16e9401df361314e..045c4feefa0731acfa1b5524046447c733e77982 100644
--- a/mhcflurry/select_allele_specific_models_command.py
+++ b/mhcflurry/select_allele_specific_models_command.py
@@ -661,7 +661,8 @@ class MassSpecModelSelector(object):
         else:
             full_matrix = hit_matrix
 
-        full_matrix = full_matrix.sample(frac=1.0).astype(float)
+        if len(full_matrix) > 0:
+            full_matrix = full_matrix.sample(frac=1.0).astype(float)
 
         self.df = full_matrix
         self.predictor = predictor