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
4c44b00c
Commit
4c44b00c
authored
9 years ago
by
Alex Rubinsteyn
Browse files
Options
Downloads
Patches
Plain Diff
add get URL for alleles
parent
3f44e0b9
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mhcflurry/class1.py
+13
-0
13 additions, 0 deletions
mhcflurry/class1.py
mhcflurry/class1_allele_specific_hyperparameters.py
+1
-1
1 addition, 1 deletion
mhcflurry/class1_allele_specific_hyperparameters.py
scripts/mhcflurry-class1-web-server.py
+13
-4
13 additions, 4 deletions
scripts/mhcflurry-class1-web-server.py
with
27 additions
and
5 deletions
mhcflurry/class1.py
+
13
−
0
View file @
4c44b00c
import
pandas
as
pd
import
os
from
.paths
import
CLASS1_MODEL_DIRECTORY
from
.mhc1_binding_predictor
import
Mhc1BindingPredictor
def
predict
(
alleles
,
peptides
):
...
...
@@ -9,3 +11,14 @@ def predict(alleles, peptides):
df
=
model
.
predict_peptides
(
peptides
)
allele_dataframes
.
append
(
df
)
return
pd
.
concat
(
allele_dataframes
)
def
supported_alleles
():
alleles
=
[]
for
filename
in
os
.
listdir
(
CLASS1_MODEL_DIRECTORY
):
allele
=
filename
.
replace
(
"
.hdf
"
,
""
)
if
len
(
allele
)
<
5
:
# skipping serotype names like A2 or B7
continue
allele
=
"
HLA-%s*%s:%s
"
%
(
allele
[
0
],
allele
[
1
:
3
],
allele
[
3
:])
alleles
.
append
(
allele
)
return
alleles
This diff is collapsed.
Click to expand it.
mhcflurry/class1_allele_specific_hyperparameters.py
+
1
−
1
View file @
4c44b00c
...
...
@@ -13,7 +13,7 @@
# limitations under the License.
N_PRETRAIN_EPOCHS
=
10
N_EPOCHS
=
1
00
N_EPOCHS
=
1
25
ACTIVATION
=
"
relu
"
INITIALIZATION_METHOD
=
"
lecun_uniform
"
EMBEDDING_DIM
=
64
...
...
This diff is collapsed.
Click to expand it.
scripts/mhcflurry-class1-web-server.py
+
13
−
4
View file @
4c44b00c
...
...
@@ -21,13 +21,13 @@ from __future__ import (
)
import
argparse
from
bottle
import
post
,
request
,
run
from
bottle
import
post
,
request
,
run
,
get
from
mhcflurry.common
import
(
split_uppercase_sequences
,
split_allele_names
,
)
from
mhcflurry.class1
import
predict
from
mhcflurry.class1
import
predict
,
supported_alleles
parser
=
argparse
.
ArgumentParser
()
...
...
@@ -47,8 +47,17 @@ def get_binding_value():
return
"
ERROR: no allele given
"
alleles_list
=
split_allele_names
(
alleles_string
)
result_df
=
predict
(
alleles
=
alleles_list
,
peptides
=
peptides_list
)
return
result_df
.
to_csv
(
sep
=
"
\t
"
,
index
=
False
)
return
result_df
.
to_csv
(
sep
=
"
\t
"
,
index
=
False
,
float_format
=
"
%0.4f
"
)
@get
(
'
/alleles
'
)
def
get_supported_alleles
():
peptide_lengths
=
"
8,9,10,11,12
"
strings
=
[
"
%s
\t
%s
"
%
(
allele
,
peptide_lengths
)
for
allele
in
supported_alleles
()
]
return
"
\n
"
.
join
(
strings
)
if
__name__
==
"
__main__
"
:
args
=
parser
.
parse_args
()
run
(
host
=
args
.
host
,
port
=
args
.
port
,
debug
=
args
.
debug
)
\ No newline at end of file
run
(
host
=
args
.
host
,
port
=
args
.
port
,
debug
=
args
.
debug
)
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