diff --git a/downloads-generation/allele_sequences/filter_sequences.py b/downloads-generation/allele_sequences/filter_sequences.py index 282fdd531942a6de77e42359c557d957fc630fb0..2d92a0b9747d6e40aaa9364ae429dc440d014651 100644 --- a/downloads-generation/allele_sequences/filter_sequences.py +++ b/downloads-generation/allele_sequences/filter_sequences.py @@ -8,7 +8,7 @@ import argparse import mhcnames -import Bio.SeqIO +import Bio.SeqIO # pylint: disable=import-error def normalize(s, disallowed=["MIC", "HFE"]): diff --git a/downloads-generation/allele_sequences/make_allele_sequences.py b/downloads-generation/allele_sequences/make_allele_sequences.py index 899eb42d29e27e48083f2bf3a618ba3654d7bd7e..d984dd34af3bb56d836b2e1a1c968cad9ff492a1 100644 --- a/downloads-generation/allele_sequences/make_allele_sequences.py +++ b/downloads-generation/allele_sequences/make_allele_sequences.py @@ -13,7 +13,7 @@ import pandas import mhcnames -import Bio.SeqIO +import Bio.SeqIO # pylint: disable=import-error def normalize_simple(s): diff --git a/mhcflurry/class1_neural_network.py b/mhcflurry/class1_neural_network.py index f23ca9773da75b80ec07304e431c4dfec47fa8e8..31a433b2c375718255d595aec6d53f936726b468 100644 --- a/mhcflurry/class1_neural_network.py +++ b/mhcflurry/class1_neural_network.py @@ -1126,6 +1126,7 @@ class Class1NeuralNetwork(object): """ import keras + import keras.backend as K from keras.layers import Input from keras.models import Model @@ -1162,7 +1163,7 @@ class Class1NeuralNetwork(object): # Merging an ensemble of pan-allele architectures network = networks[0] peptide_input = Input( - shape=tuple(int(x) for x in network.inputs[0].shape[1:]), + shape=tuple(int(x) for x in K.int_shape(network.inputs[0])[1:]), dtype='float32', name='peptide') allele_input = Input( @@ -1366,7 +1367,7 @@ class Class1NeuralNetwork(object): l is the allele sequence length, m is the length of the vectors used to represent amino acids """ - from keras.models import model_from_json + from keras.models import clone_model reshaped = allele_representations.reshape( (allele_representations.shape[0], -1)) original_model = self.network() @@ -1392,7 +1393,7 @@ class Class1NeuralNetwork(object): # Network surgery required. Make a new network with this layer's # dimensions changed. Kind of a hack. layer.input_dim = reshaped.shape[0] - new_model = model_from_json(original_model.to_json()) + new_model = clone_model(original_model) # copy weights for other layers over for layer in new_model.layers: diff --git a/mhcflurry/train_pan_allele_models_command.py b/mhcflurry/train_pan_allele_models_command.py index a985539deddd836afdc5185dfaaca0f7fdbc8f31..c1b015e4573341cae239a306ed52db159c587aac 100644 --- a/mhcflurry/train_pan_allele_models_command.py +++ b/mhcflurry/train_pan_allele_models_command.py @@ -270,7 +270,7 @@ def run(argv=sys.argv[1:]): return main(args) except Exception as e: print(e) - import ipdb + import ipdb # pylint: disable=import-error ipdb.set_trace() raise else: