Commit 4ef7b63a authored by Yan's avatar Yan
Browse files

Unified routines for opentims subselection

parent 56502331
......@@ -14,7 +14,7 @@ from . import zcetools_help
from . import reactivitytools
__version__ = "0.0.40"
__version__ = "0.0.41"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'datasets',
......
......@@ -196,35 +196,30 @@ class BrukerTimsDataset(Dataset):
np.clip(self.chromatograms[0][1], np.finfo(np.float32).eps, None))
return intensity
def get_mobilogram(self, startm, endm, mint=None, maxt=None):
logger.info("getting timsTOF mobilogram")
def get_subspace(self, xax, subselect, start, end, bins,
mint=None, maxt=None):
mint = mint or self.mintime
maxt = maxt or self.maxtime
logger.info(("getting timsTOF for {:.3f}-{:.3f} minutes, subselecting"
" {}: {}-{}").format(mint, maxt, subselect, start, end))
framessel = self.sampletimes(mint, maxt, cf.settings().value(
"timstof/mob_sampling", type=int))
massintstof = self.dataset.query(
framessel, columns=('mz', 'intensity', 'inv_ion_mobility'))
goodargs = dt.argsubselect(massintstof['mz'], startm, endm)
framessel, columns=(subselect, 'intensity', xax))
goodargs = dt.argsubselect(massintstof[subselect], start, end)
mobs, ints = self.binit(
massintstof['inv_ion_mobility'][goodargs],
massintstof['intensity'][goodargs],
cf.settings().value("timstof/mob_bins", type=float),
massintstof[xax][goodargs], massintstof['intensity'][goodargs],
cf.settings().value("timstof/{}".format(bins), type=float),
len(framessel))
return mobs, ints
def get_ms_onmob(self, startmob, endmob, mint=None, maxt=None):
logger.info("getting timsTOF mobilogram")
mint = mint or self.mintime
maxt = maxt or self.maxtime
framessel = self.sampletimes(mint, maxt, cf.settings().value(
"timstof/mob_sampling", type=int))
massintstof = self.dataset.query(
framessel, columns=('mz', 'intensity', 'inv_ion_mobility'))
goodargs = dt.argsubselect(massintstof['inv_ion_mobility'],
startmob, endmob)
mz, ints = self.binit(
massintstof['mz'][goodargs],
massintstof['intensity'][goodargs],
cf.settings().value("timstof/ms_bins", type=float),
len(framessel))
return mz, ints
def get_mobilogram(self, startm, endm, mint=None, maxt=None):
x, y = self. get_subspace('inv_ion_mobility', 'mz',
startm, endm, 'mob_bins', mint, maxt)
return x, y
def get_ms_onmob(self, startm, endm, mint=None, maxt=None):
x, y = self.get_subspace('mz', 'inv_ion_mobility',
startm, endm, 'ms_bins', mint, maxt)
return x, y
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment