From 09dd0cd902b59c38221696a6e1c6f35cc095a582 Mon Sep 17 00:00:00 2001 From: Tim O'Donnell <timodonnell@gmail.com> Date: Tue, 3 Dec 2019 17:56:33 -0500 Subject: [PATCH] renames --- mhcflurry/batch_generator.py | 2 +- mhcflurry/class1_presentation_neural_network.py | 17 +++++++++-------- mhcflurry/class1_presentation_predictor.py | 4 ++-- mhcflurry/multiallelic_refinement_command.py | 10 +++++----- test/test_class1_presentation_predictor.py | 1 - 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mhcflurry/batch_generator.py b/mhcflurry/batch_generator.py index 570cc8ad..ca512072 100644 --- a/mhcflurry/batch_generator.py +++ b/mhcflurry/batch_generator.py @@ -103,7 +103,7 @@ class MultiallelicMassSpecBatchGenerator(object): batch_generator_batch_size=128, batch_generator_affinity_fraction=0.5) """ - Hyperperameters for batch generation for the ligandome predictor. + Hyperperameters for batch generation for the presentation predictor. """ def __init__(self, hyperparameters): diff --git a/mhcflurry/class1_presentation_neural_network.py b/mhcflurry/class1_presentation_neural_network.py index db3a2535..897fafd8 100644 --- a/mhcflurry/class1_presentation_neural_network.py +++ b/mhcflurry/class1_presentation_neural_network.py @@ -195,22 +195,23 @@ class Class1PresentationNeuralNetwork(object): [node, auxiliary_input], name="affinities_with_auxiliary") layer = Dense(8, activation="tanh") - lifted = TimeDistributed(layer, name="ligandome_hidden1") + lifted = TimeDistributed(layer, name="presentation_hidden1") node = lifted(node) layer = Dense(1, activation="tanh") - lifted = TimeDistributed(layer, name="ligandome_output") - ligandome_adjustment = lifted(node) + lifted = TimeDistributed(layer, name="presentation_hidden2") + presentation_adjustment = lifted(node) def logit(x): import tensorflow as tf return - tf.log(1. / x - 1.) - ligandome_output_pre_sigmoid = Add()([ + presentation_output_pre_sigmoid = Add()([ Lambda(logit)(affinity_predictor_matrix_output), - ligandome_adjustment, + presentation_adjustment, ]) - ligandome_output = Activation("sigmoid")(ligandome_output_pre_sigmoid) + presentation_output = Activation("sigmoid", name="presentation_output")( + presentation_output_pre_sigmoid) self.network = Model( inputs=[ @@ -219,10 +220,10 @@ class Class1PresentationNeuralNetwork(object): ] + ([] if auxiliary_input is None else [auxiliary_input]), outputs=[ affinity_predictor_output, - ligandome_output, + presentation_output, affinity_predictor_matrix_output ], - name="ligandome", + name="presentation", ) self.network.summary() diff --git a/mhcflurry/class1_presentation_predictor.py b/mhcflurry/class1_presentation_predictor.py index 1471ad97..625b32f4 100644 --- a/mhcflurry/class1_presentation_predictor.py +++ b/mhcflurry/class1_presentation_predictor.py @@ -36,11 +36,11 @@ from .custom_loss import ( class Class1PresentationPredictor(object): def __init__( self, - class1_ligandome_neural_networks, + class1_presentation_neural_networks, allele_to_sequence, manifest_df=None, metadata_dataframes=None): - self.networks = class1_ligandome_neural_networks + self.networks = class1_presentation_neural_networks self.allele_to_sequence = allele_to_sequence self._manifest_df = manifest_df self.metadata_dataframes = ( diff --git a/mhcflurry/multiallelic_refinement_command.py b/mhcflurry/multiallelic_refinement_command.py index 1e47e77f..324efff0 100644 --- a/mhcflurry/multiallelic_refinement_command.py +++ b/mhcflurry/multiallelic_refinement_command.py @@ -57,17 +57,17 @@ parser.add_argument( parser.add_argument( "--hyperparameters", metavar="FILE.json", - help="Ligandome predictor hyperparameters") + help="presentation predictor hyperparameters") parser.add_argument( "--out-affinity-predictor-dir", metavar="DIR", required=True, help="Directory to write refined models") parser.add_argument( - "--out-ligandome-predictor-dir", + "--out-presentation-predictor-dir", metavar="DIR", required=True, - help="Directory to write ligandome predictors") + help="Directory to write preentation predictor") parser.add_argument( "--verbosity", type=int, @@ -89,8 +89,8 @@ def run(argv=sys.argv[1:]): args.out_affinity_predictor_dir = os.path.abspath( args.out_affinity_predictor_dir) - args.out_ligandome_predictor_dir = os.path.abspath( - args.out_ligandome_predictor_dir) + args.out_presentation_predictor_dir = os.path.abspath( + args.out_presentation_predictor_dir) configure_logging(verbose=args.verbosity > 1) diff --git a/test/test_class1_presentation_predictor.py b/test/test_class1_presentation_predictor.py index 768d270a..bbd0bf1e 100644 --- a/test/test_class1_presentation_predictor.py +++ b/test/test_class1_presentation_predictor.py @@ -56,7 +56,6 @@ def data_path(name): return os.path.join(os.path.dirname(__file__), "data", name) - def setup(): global PAN_ALLELE_PREDICTOR_NO_MASS_SPEC global PAN_ALLELE_MOTIFS_WITH_MASS_SPEC_DF -- GitLab