Skip to content

Commit

Permalink
creating range of desirable GRAVY scores
Browse files Browse the repository at this point in the history
  • Loading branch information
iskandr committed Oct 21, 2018
1 parent bd9ecda commit fa368b6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion vaxrank/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.1"
__version__ = "1.0.0"
24 changes: 14 additions & 10 deletions vaxrank/core_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,26 @@ def vaccine_peptides_for_variant(
for vp in candidate_vaccine_peptides
if vp.combined_score / max_score > 0.99
]

n_filtered = len(filtered_candidate_vaccine_peptides)
logger.info(
"Keeping %d/%d vaccine peptides for %s",
len(filtered_candidate_vaccine_peptides),
n_filtered,
n_total_candidates,
variant)

if n_filtered == 0:
return []

filtered_candidate_vaccine_peptides.sort(key=VaccinePeptide.lexicographic_sort_key)

if len(filtered_candidate_vaccine_peptides) > 0:
logger.debug("Top vaccine peptides for %s:", variant)
for i, vaccine_peptide in enumerate(filtered_candidate_vaccine_peptides):
logger.debug(
"%d) %s (combined score = %0.4f)",
i + 1,
vaccine_peptide,
vaccine_peptide.combined_score)
logger.debug("Top vaccine peptides for %s:", variant)
for i, vaccine_peptide in enumerate(filtered_candidate_vaccine_peptides):
logger.debug(
"%d) %s (combined score = %0.4f)",
i + 1,
vaccine_peptide,
vaccine_peptide.combined_score)

return filtered_candidate_vaccine_peptides[:self.max_vaccine_peptides_per_variant]

@property
Expand Down
21 changes: 18 additions & 3 deletions vaxrank/vaccine_peptide.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def __new__(
def peptide_synthesis_difficulty_score_tuple(
self,
max_c_terminal_hydropathy=1.5,
max_kmer_hydropathy=2.5):
min_kmer_hydropathy=0,
max_kmer_hydropathy_low_priority=1.5,
max_kmer_hydropathy_high_priority=2.5):
"""
Generates a tuple of scores used for lexicographic sorting of vaccine
peptides.
Expand All @@ -95,7 +97,10 @@ def peptide_synthesis_difficulty_score_tuple(
If there are multiple vaccine peptides without difficult terminal
residues then try to eliminate N-terminal asparagine residues
(not as harmful) and asparagine-proline bonds
(known to dissociate easily).
(known to dissociate easily). If all of these constraints
are satisfied, then attempt to keep the max k-mer hydropahy below
a lower constant (default GRAVY score 1.5) and above a minimum value
(default 0).
(Sort criteria determined through conversations with manufacturer)
"""
Expand All @@ -109,10 +114,12 @@ def peptide_synthesis_difficulty_score_tuple(
self.manufacturability_scores.cysteine_count,

# C-terminal 7mer GRAVY score < 1.5
# (or user specified max GRAVY score for C terminus of peptide)
max(0, cterm_7mer_gravy - max_c_terminal_hydropathy),

# max 7mer GRAVY score < 2.5
max(0, max_7mer_gravy - max_kmer_hydropathy),
# (or user specified higher priority maximum for GRAVY score)
max(0, max_7mer_gravy - max_kmer_hydropathy_high_priority),

# avoid N-terminal Gln, Glu, Cys
self.manufacturability_scores.difficult_n_terminal_residue,
Expand All @@ -128,6 +135,14 @@ def peptide_synthesis_difficulty_score_tuple(

# avoid Asp-Pro bonds
self.manufacturability_scores.asparagine_proline_bond_count,

# max 7mer GRAVY score < 1.5
# (or user specified lower priority maximum for GRAVY score)
max(0, max_7mer_gravy - max_kmer_hydropathy_low_priority),

# max 7mer GRAVY score > 0
# (or user specified min GRAVY for 7mer windows in peptide)
max(0, min_kmer_hydropathy - max_7mer_gravy),
)

def lexicographic_sort_key(self):
Expand Down

0 comments on commit fa368b6

Please sign in to comment.