From 6b592c812fa0bd12da730c313aae9aa7f75bd3a0 Mon Sep 17 00:00:00 2001 From: Tim O'Donnell <timodonnell@gmail.com> Date: Mon, 17 Apr 2017 17:58:27 -0400 Subject: [PATCH] update --- mhcflurry/antigen_presentation/presentation_model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mhcflurry/antigen_presentation/presentation_model.py b/mhcflurry/antigen_presentation/presentation_model.py index 73c1f688..33e3e709 100644 --- a/mhcflurry/antigen_presentation/presentation_model.py +++ b/mhcflurry/antigen_presentation/presentation_model.py @@ -422,6 +422,8 @@ class PresentationModel(object): assert 'experiment_name' in peptides_df.columns assert 'hit' in peptides_df.columns + peptides_df = peptides_df.copy() + peptides_df["prediction"] = self.predict(peptides_df) top_n = float(peptides_df.hit.sum()) @@ -432,8 +434,13 @@ class PresentationModel(object): } else: ranks = peptides_df.prediction.rank(ascending=False) + hit_indices = ranks[peptides_df.hit > 0].values + hit_lengths = peptides_df.peptide[ + peptides_df.hit > 0 + ].str.len().values result = { - 'hit_indices': numpy.sort(ranks[peptides_df.hit > 0].values), + 'hit_indices': hit_indices, + 'hit_lengths': hit_lengths, 'total_peptides': len(peptides_df), } result['score'] = ( -- GitLab