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
4f026cf9
Commit
4f026cf9
authored
8 years ago
by
Alex Rubinsteyn
Browse files
Options
Downloads
Patches
Plain Diff
fixed commandline script for making predictions
parent
2b0df761
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mhcflurry/common.py
+1
-2
1 addition, 2 deletions
mhcflurry/common.py
script/mhcflurry-predict-class1.py
+16
-1
16 additions, 1 deletion
script/mhcflurry-predict-class1.py
with
17 additions
and
3 deletions
mhcflurry/common.py
+
1
−
2
View file @
4f026cf9
...
...
@@ -20,8 +20,7 @@ from collections import defaultdict
import
numpy
as
np
def
parse_int_list
(
s
):
return
[
int
(
part
.
strip
()
for
part
in
s
.
split
(
"
,
"
))]
return
[
int
(
part
.
strip
())
for
part
in
s
.
split
(
"
,
"
)]
def
split_uppercase_sequences
(
s
):
return
[
part
.
strip
().
upper
()
for
part
in
s
.
split
(
"
,
"
)]
...
...
This diff is collapsed.
Click to expand it.
script/mhcflurry-predict-class1.py
+
16
−
1
View file @
4f026cf9
...
...
@@ -28,6 +28,7 @@ from mhcflurry.common import (
split_allele_names
,
)
from
mhcflurry.predict
import
predict
from
six
import
string_types
parser
=
argparse
.
ArgumentParser
()
...
...
@@ -55,5 +56,19 @@ parser.add_argument(
if
__name__
==
"
__main__
"
:
args
=
parser
.
parse_args
()
df
=
predict
(
alleles
=
args
.
mhc
,
peptides
=
args
.
sequence
)
if
len
(
args
.
peptide_lengths
)
==
0
:
raise
ValueError
(
"
Must specify at least one peptide length
"
)
long_sequences
=
args
.
sequence
if
isinstance
(
long_sequences
,
string_types
):
long_sequences
=
[
long_sequences
]
peptides
=
[]
for
peptide_length
in
args
.
peptide_lengths
:
for
long_sequence
in
long_sequences
:
total_length
=
len
(
long_sequence
)
for
i
in
range
(
total_length
-
peptide_length
):
peptides
.
append
(
long_sequence
[
i
:
i
+
peptide_length
])
print
(
"
Running predictor over %d sub-sequences
"
%
len
(
peptides
))
df
=
predict
(
alleles
=
args
.
mhc
,
peptides
=
peptides
)
print
(
df
.
to_csv
(
sep
=
"
\t
"
,
index
=
False
),
end
=
""
)
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