[Biojava-dev] Exception in MassCalc.getMass

george waldon gwaldon at geneinfinity.org
Fri Mar 30 05:28:51 UTC 2007


I got a NullPointerException in MassCalc.getMass that I traced to the presence of an ambiguity symbol X in the peptide sequence. 
The origin lies in SimpleSymbolPropertyTable.getDoubleValue.  The ambiguity symbol is first validated (through its matches in AbstractAlphabet) and the exception is thrown when we try to find a value associated with a null key in the property map.
First I think we should redirect this exception to the checked IllegalSymbolException to tell the user that something is going wrong.
Concerning calculating masses, I see two needs: need to estimate the mass of polypeptides containing ambiguity symbols and need to obtain an exact mass or an IllegalSymbolException when ambiguity occurs.
I propose to add a new method MassCalc.getEstimatedMass to do the first part and to modify the existing method so that  an IllegalSymbolException is thrown whenever a non-atomic symbol is encounter. Mass values for ambiguity symbols would be added to the ResidueProperty.xml file and taken as simple average of the atomic match values.

- George



More information about the biojava-dev mailing list