Skip to content

Commit

Permalink
use same default isotopePattern params as in v0.3
Browse files Browse the repository at this point in the history
removed legacy_interface.py (no longer used by sm-engine)
  • Loading branch information
Artem Tarasov committed Aug 21, 2017
1 parent ed386f7 commit 18cc2b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 40 deletions.
36 changes: 0 additions & 36 deletions cpyMSpec/legacy_interface.py

This file was deleted.

14 changes: 12 additions & 2 deletions cpyMSpec/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,24 @@ def trimmed(self, n_peaks):
def removeIntensitiesBelow(self, min_intensity):
ims.spectrum_trim_intensity(self.ptr, min_intensity)

def isotopePattern(sum_formula, desired_prob=0.99999):
def isotopePattern(sum_formula, threshold=1e-4, rel_threshold=True, desired_prob=0.99999):
"""
Calculates isotopic peaks for a sum formula.
:param sum_formula: text representation of an atomic composition
:type sum_formula: str
:param threshold: minimum peak abundance; if nonzero, desired_prob parameter is ignored
:type threshold: float
:param rel_threshold: if True, threshold is relative to the highest peak, otherwise it is a probability
:type rel_threshold: bool
:param desired_prob: total probability covered by the result
:type desired_prob: float
"""
s = ims.spectrum_new_from_sf(sum_formula.encode('ascii'), desired_prob)
assert threshold >= 0 and threshold < 1
assert desired_prob > 0 and desired_prob <= 1

if threshold > 0:
s = ims.spectrum_new_from_sf_thr(sum_formula.encode('ascii'), threshold, rel_threshold)
else:
s = ims.spectrum_new_from_sf(sum_formula.encode('ascii'), desired_prob)
return _new_spectrum(TheoreticalSpectrum, s)
2 changes: 1 addition & 1 deletion cpyMSpec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def init_ffi():
def load_shared_lib(ffi):
return ffi.dlopen(full_filename(shared_lib("ms_cffi")))

VERSION = "0.4.0"
VERSION = "0.4.1"
2 changes: 1 addition & 1 deletion ims-cpp

0 comments on commit 18cc2b9

Please sign in to comment.