From 9ef82bae0b9da8b509e150f18ff3fa3c52247b56 Mon Sep 17 00:00:00 2001 From: Alex Rubinsteyn <alex.rubinsteyn@gmail.com> Date: Mon, 9 Jan 2017 14:25:46 -0500 Subject: [PATCH] allow commas in peptide and allele strings for mhcflurry-predict, incrememented keras version --- mhcflurry/predict_command.py | 15 +++++++++++++-- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mhcflurry/predict_command.py b/mhcflurry/predict_command.py index 4a010402..edcc6af0 100644 --- a/mhcflurry/predict_command.py +++ b/mhcflurry/predict_command.py @@ -122,8 +122,19 @@ def run(argv=sys.argv[1:]): parser.error( "Specify either an input CSV file or both the " "--alleles and --peptides arguments") - - pairs = list(itertools.product(args.alleles, args.peptides)) + # split user specified allele and peptide strings in case they + # contain multiple entries separated by commas + alleles = [] + for allele_string in args.alleles: + alleles.extend([s.strip() for s in allele_string.split(",")]) + peptides = [] + for peptide in args.peptides: + peptides.extend(peptide.strip() for p in peptide.split(",")) + for peptide in peptides: + if not peptide.isalpha(): + raise ValueError( + "Unexpected character(s) in peptide '%s'" % peptide) + pairs = list(itertools.product(alleles, peptides)) df = pandas.DataFrame({ "allele": [p[0] for p in pairs], "peptide": [p[1] for p in pairs], diff --git a/requirements.txt b/requirements.txt index 78a52a93..e1768825 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ numpy>= 1.11 pandas>=0.13.1 appdirs theano>=0.8.2 -keras==1.1.0 +keras==1.2.0 fancyimpute>=0.0.12 scikit-learn h5py diff --git a/setup.py b/setup.py index 1571028c..422d2eca 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ if __name__ == '__main__': 'pandas>=0.13.1', 'appdirs', 'theano>=0.8.2', - 'keras==1.1.0', + 'keras==1.2.0', 'fancyimpute>=0.0.12', 'scikit-learn', 'h5py', -- GitLab