Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mhc_rank
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Patrick Skillman-Lawrence
mhc_rank
Commits
7c9b0340
Commit
7c9b0340
authored
5 years ago
by
Tim O'Donnell
Browse files
Options
Downloads
Patches
Plain Diff
working on cleavage
parent
c9841e49
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mhcflurry/class1_cleavage_neural_network.py
+26
-1
26 additions, 1 deletion
mhcflurry/class1_cleavage_neural_network.py
with
26 additions
and
1 deletion
mhcflurry/class1_cleavage_neural_network.py
+
26
−
1
View file @
7c9b0340
...
...
@@ -426,7 +426,9 @@ class Class1CleavageNeuralNetwork(object):
kernel_size
=
1
,
kernel_regularizer
=
keras
.
regularizers
.
l1_l2
(
*
convolutional_kernel_l1_l2
),
activation
=
convolutional_activation
)(
current_layer
)
activation
=
(
"
tanh
"
if
size
==
1
else
convolutional_activation
))(
current_layer
)
single_output_result
=
current_layer
if
flank
==
"
n_flank
"
:
...
...
@@ -436,6 +438,25 @@ class Class1CleavageNeuralNetwork(object):
single_output_at_cleavage_position
=
keras
.
layers
.
Lambda
(
cleavage_extractor
,
name
=
"
%s_cleaved
"
%
flank
)(
single_output_result
)
def
max_pool_over_peptide_extractor
(
lst
):
import
tensorflow
as
tf
import
tensorflow.ragged
(
x
,
peptide_length
)
=
lst
starts
=
n_flank_length
+
1
limits
=
n_flank_length
+
tf
.
squeeze
(
peptide_length
)
range
=
tensorflow
.
ragged
.
range
(
starts
,
limits
)
values
=
tf
.
gather
(
x
,
range
,
batch_dims
=
1
,
axis
=
1
)
max_value
=
tf
.
reduce_max
(
values
,
axis
=
0
)
return
max_value
max_over_peptide
=
keras
.
layers
.
Lambda
(
max_pool_over_peptide_extractor
,
name
=
"
%s_internal_cleaved
"
%
flank
)([
single_output_result
,
model_inputs
[
'
peptide_length
'
]
])
else
:
assert
flank
==
"
c_flank
"
...
...
@@ -454,7 +475,11 @@ class Class1CleavageNeuralNetwork(object):
model_inputs
[
'
peptide_length
'
]
])
max_over_peptide
=
None
outputs_for_final_dense
.
append
(
single_output_at_cleavage_position
)
if
max_over_peptide
is
not
None
:
outputs_for_final_dense
.
append
(
max_over_peptide
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment