openvax / mhctools

Python interface to running command-line and web-based MHC binding predictors
Apache License 2.0
89 stars 22 forks source link

overflow error in add_binding_prediction #41

Closed timodonnell closed 8 years ago

timodonnell commented 9 years ago

Haven't debugged this, not sure what's really going on, but posting it here in case others see it:

---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
<ipython-input-143-fce0819e8e73> in <module>()
     17         )
     18 
---> 19         predicted_epitopes = epitopes(donor, tuple(sorted(list(calls.index[calls]))))
     20 
     21         combined_df["sample"].append(shorten_sample(tumor_source))

/Users/tim/sinai/git/varcode/varcode/common.pyc in wrapped_fn(*args, **kwargs)
     45             return memoized_values[key]
     46         except KeyError:
---> 47             memoized_values[key] = fn(*args, **kwargs)
     48             return memoized_values[key]
     49 

<ipython-input-142-a48af2a83592> in epitopes(donor, variants)
      6     predictor = mhctools.NetMHCpan(alleles)
      7     epitope_predictor = topiary.MutantEpitopePredictor(predictor)
----> 8     epitope_predictions = epitope_predictor.epitopes_from_variants(varcode.VariantCollection(list(variants)))
      9 
     10     variant_to_epitopes = collections.defaultdict(list)

/Users/tim/sinai/git/topiary/topiary/mutant_epitope_predictor.pyc in epitopes_from_variants(self, variants, gene_expression_dict, gene_expression_threshold, transcript_expression_dict, transcript_expression_threshold, raise_on_variant_effect_error)
    306             gene_expression_threshold=gene_expression_threshold,
    307             transcript_expression_dict=transcript_expression_dict,
--> 308             transcript_expression_threshold=transcript_expression_threshold)

/Users/tim/sinai/git/topiary/topiary/mutant_epitope_predictor.pyc in epitopes_from_mutation_effects(self, effects, gene_expression_dict, gene_expression_threshold, transcript_expression_dict, transcript_expression_threshold)
    210         # predictions to reflect the longer source sequence they come from
    211         binding_predictions = []
--> 212         for x in self.mhc_model.predict(peptide_dict):
    213             effect = x.source_sequence_key
    214             (source_sequence, source_start, _) = peptide_interval_dict[effect]

/Users/tim/venvs/analysis-venv-2.7/lib/python2.7/site-packages/mhctools/netmhc_pan.pyc in predict(self, fasta_dictionary)
     71                     sequence_key_mapping=sequence_key_mapping,
     72                     fasta_dictionary=fasta_dictionary,
---> 73                     prediction_method_name="netmhcpan")
     74 
     75         if len(epitope_collection) == 0:

/Users/tim/venvs/analysis-venv-2.7/lib/python2.7/site-packages/mhctools/file_formats.pyc in parse_netmhc_stdout(netmhc_output, fasta_dictionary, prediction_method_name, sequence_key_mapping)
    128                 ic50=ic50,
    129                 rank=rank,
--> 130                 log_ic50=log_affinity)
    131     return builder.get_collection()
    132 

/Users/tim/venvs/analysis-venv-2.7/lib/python2.7/site-packages/mhctools/epitope_collection_builder.pyc in add_binding_prediction(self, source_sequence_key, offset, peptide, allele, ic50, rank, log_ic50)
     82         # log of the score. Strangely, this is necessary sometimes!
     83         if invalid_binding_score(ic50) and log_ic50 is not None:
---> 84             ic50 = 50000 ** (-log_ic50 + 1)
     85         # if IC50 is still NaN or otherwise invalid, abort
     86         if invalid_binding_score(ic50):

OverflowError: (34, 'Result too large')
iskandr commented 9 years ago

@timodonnell Looks like a failure in parsing the output of NetMHCpan. Can you post the VCF file & alleles that caused this? (or email them to me if they're too big or not appropriate for github)

timodonnell commented 9 years ago

I unfortunately can't reproduce it now (haven been running over various subsets of mutations and didn't save the combination that caused this) but I will update this ticket if I manage it hit it again.