Skip to content

Commit

Permalink
Merge pull request #1048 from griffithlab/mhcflurry_no_percentile
Browse files Browse the repository at this point in the history
Handle output from MHCflurry when one of the percentiles is empty
  • Loading branch information
susannasiebert authored Jan 10, 2024
2 parents 6992934 + 573c67f commit 2310013
Show file tree
Hide file tree
Showing 6 changed files with 864 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pvactools/lib/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,15 @@ def add_summary_metrics(self, iedb_results):
corresponding_wt = result['wt_{}s'.format(metric)][best_mt_value_method]['ic50']
calculated_median = median([score['ic50'] for score in mt_values.values()])
else:
corresponding_wt = min(result['wt_{}s'.format(metric)][best_mt_value_method].values())
corresponding_wts = list(result['wt_{}s'.format(metric)][best_mt_value_method].values())
if len(corresponding_wts) > 1:
none_na_corresponding_wts = [p for p in corresponding_wts if p != 'NA']
if len(none_na_corresponding_wts) == 0:
corresponding_wt = 'NA'
else:
corresponding_wt = min(none_na_corresponding_wts)
else:
corresponding_wt = corresponding_wts[0]
flattend_percentiles = [percentile for method_results in mt_values.values() for percentile in method_results.values()]
calculated_median = median(flattend_percentiles)

Expand Down
Loading

0 comments on commit 2310013

Please sign in to comment.