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
629baf60
Commit
629baf60
authored
8 years ago
by
Alex Rubinsteyn
Browse files
Options
Downloads
Patches
Plain Diff
small fixes
parent
d1aa3d76
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py
+1
-0
1 addition, 0 deletions
mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py
mhcflurry/common.py
+1
-1
1 addition, 1 deletion
mhcflurry/common.py
mhcflurry/dataset.py
+11
-10
11 additions, 10 deletions
mhcflurry/dataset.py
with
13 additions
and
11 deletions
mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py
+
1
−
0
View file @
629baf60
...
...
@@ -44,6 +44,7 @@ class Class1AlleleSpecificKmerIC50PredictorBase(IC50PredictorBase):
max_ic50
=
MAX_IC50
,
kmer_size
=
9
):
IC50PredictorBase
.
__init__
(
self
,
name
=
name
,
max_ic50
=
max_ic50
,
verbose
=
verbose
)
...
...
This diff is collapsed.
Click to expand it.
mhcflurry/common.py
+
1
−
1
View file @
629baf60
...
...
@@ -75,7 +75,7 @@ def geometric_mean(xs, weights=None):
if
len
(
xs
)
==
1
:
return
xs
[
0
]
elif
weights
is
None
:
return
exp
(
sum
(
log
(
xi
)
for
xi
in
xs
))
return
exp
(
sum
(
log
(
xi
)
for
xi
in
xs
)
/
len
(
xs
)
)
sum_weighted_log
=
sum
(
log
(
xi
)
*
wi
for
(
xi
,
wi
)
in
zip
(
xs
,
weights
))
denom
=
sum
(
weights
)
return
exp
(
sum_weighted_log
/
denom
)
This diff is collapsed.
Click to expand it.
mhcflurry/dataset.py
+
11
−
10
View file @
629baf60
...
...
@@ -97,28 +97,28 @@ class Dataset(object):
"""
Array of peptides from pMHC measurements.
"""
return
self
.
_peptides
return
self
.
_
df
[
"
peptide
"
].
value
s
@property
def
alleles
(
self
):
"""
Array of MHC allele names from pMHC measurements.
"""
return
self
.
_allel
es
return
self
.
to_dataframe
()[
"
allele
"
].
valu
es
@property
def
affinities
(
self
):
"""
Array of affinities from pMHC measurements.
"""
return
self
.
_affiniti
es
return
self
.
to_dataframe
()[
"
affinity
"
].
valu
es
@property
def
sample_weights
(
self
):
"""
Array of sample weights for each pMHC measurement.
"""
return
self
.
_
sample_weights
return
self
.
to_dataframe
()[
"
sample_weight
"
].
value
s
def
__len__
(
self
):
return
len
(
self
.
to_dataframe
())
...
...
@@ -136,18 +136,14 @@ class Dataset(object):
return
False
elif
len
(
self
)
!=
len
(
other
):
return
False
elif
l
en
(
self
.
columns
)
!=
l
en
(
other
.
columns
):
elif
l
ist
(
self
.
columns
)
!=
l
ist
(
other
.
columns
):
return
False
for
ci
,
cj
in
zip
(
self
.
columns
,
other
.
columns
):
if
ci
!=
cj
:
return
False
self_df
=
self
.
to_dataframe
()
other_df
=
other
.
to_dataframe
()
for
column_name
in
self
.
columns
:
if
not
(
self_df
[
column_name
]
=
=
other_df
[
column_name
]).
a
ll
():
if
(
self_df
[
column_name
]
!
=
other_df
[
column_name
]).
a
ny
():
return
False
return
True
...
...
@@ -373,6 +369,11 @@ class Dataset(object):
Create zero or more peptides from each pMHC entry. The affinity of all
new peptides is identical to the original, but sample weights are
divided across the number of new peptides.
Parameters
----------
peptide_fn : function
Maps each peptide to a list of peptides.
"""
columns
=
self
.
to_dataframe
().
columns
new_data_dict
=
OrderedDict
(
...
...
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