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
b46367de
Commit
b46367de
authored
8 years ago
by
Alex Rubinsteyn
Browse files
Options
Downloads
Patches
Plain Diff
adding counting helpers
parent
e1177819
Branches
develop
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mhcflurry/single_allele_dataset.py
+15
-6
15 additions, 6 deletions
mhcflurry/single_allele_dataset.py
with
15 additions
and
6 deletions
mhcflurry/single_allele_dataset.py
+
15
−
6
View file @
b46367de
...
...
@@ -92,10 +92,13 @@ class SingleAlleleDataset(object):
require_instance
(
kmer_size
,
integer_types
)
self
.
kmer_size
=
kmer_size
# "original" entries might contain multiple measurements for the same
# peptide
self
.
original_peptides
=
prepare_peptides_array
(
peptides
=
peptides
)
self
.
original_ic50_values
=
prepare_ic50_values_array
(
ic50_values
=
ic50_values
,
required_count
=
len
(
self
.
peptides
))
# since data may contain multiple measurements for the same pMHC,
# combine them using the geometric mean of the measured IC50 values
self
.
peptides
,
self
.
ic50_values
=
\
...
...
@@ -161,15 +164,20 @@ class SingleAlleleDataset(object):
max_ic50
=
max_ic50
,
kmer_size
=
kmer_size
)
def
peptide_
count
(
self
):
def
count
(
self
):
"""
Returns number of distinct peptides in this dataset
(not k-mers extracted from peptides)
"""
return
len
(
self
.
peptides
)
def
kmer_count
(
self
):
return
len
(
self
.
kmers
)
def
count_before_combining_measurements
(
self
):
"""
How many entries are the in dataset before combining measurements
from identical peptide sequences?
"""
return
len
(
self
.
original_peptides
)
@property
def
peptide_to_ic50_dict
(
self
):
...
...
@@ -180,15 +188,16 @@ class SingleAlleleDataset(object):
(
p
,
ic50
)
for
(
p
,
ic50
)
in
zip
(
self
.
peptides
,
self
.
ic50_values
)])
@property
def
peptide_to_re
scaled_affinity
_dict
(
self
):
def
peptide_to_re
gression_target
_dict
(
self
):
"""
Returns dictionary mapping each peptide to a value between [0, 1]
where 0 means the IC50 was self.max_ic50 or greater and 1 means a strong
binder.
"""
affinities
=
return
OrderedDict
([
p
,
tran
])
(
p
,
y
)
for
(
p
,
y
)
in
zip
(
self
.
peptides
,
self
.
regression_targets
)])
@property
def
kmers
(
self
):
\ No newline at end of file
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