예제 #1
0
 def _scan_id(self, scan):
     scan_number = scan.scan_number
     return _make_id(scan_number + 1)
예제 #2
0
 def _pack_index(self):
     index = OrderedDict()
     for sn in range(self._source.RunHeaderEx.FirstSpectrum - 1,
                     self._source.RunHeaderEx.LastSpectrum):
         index[_make_id(sn)] = sn
     return index
예제 #3
0
 def _pack_index(self):
     index = OrderedDict()
     for sn in range(1, self._source.NumSpectra + 1):
         index[_make_id(sn)] = sn
     return index
예제 #4
0
    def _precursor_information(self, scan):
        if self._ms_level(scan) == 1:
            return None
        scan_number = scan.scan_number
        pinfo_struct = self._source.GetPrecursorInfoFromScanNum(scan_number)
        precursor_scan_number = None
        labels, _, _ = self._source.GetAllMSOrderData(scan_number)
        if pinfo_struct:
            # this struct field is unreliable and may fall outside the
            # isolation window
            mz = pinfo_struct.monoIsoMass
            charge = pinfo_struct.chargeState
            intensity = float(labels.intensity[0])
            # this struct field is unreliable, and simple to infer
            # precursor_scan_number = pinfo_struct.scanNumber + 1
        else:
            mz = labels.mass[0]
            intensity = float(labels.intensity[0])
            charge = labels.charge[0]
        if not charge:
            charge = ChargeNotProvided
        trailer = self._trailer_values(scan)
        _mz = trailer.get('Monoisotopic M/Z', 0.0)
        # prefer the trailer m/z if available?
        if _mz > 0:
            mz = _mz

        # imitate proteowizard's firmware bug correction
        isolation_window = self._isolation_window(scan)
        if (isolation_window.upper + isolation_window.lower) / 2 <= 2.0:
            if (isolation_window.target - 3.0 > mz) or (isolation_window.target + 2.5 < mz):
                mz = isolation_window.target
        elif mz not in isolation_window:
            mz = isolation_window.target
        _charge = trailer.get('Charge State', 0)
        if _charge != 0:
            charge = _charge
        # Guess which previous scan was the precursor by iterating
        # backwards until a scan is found with a lower MS level
        if precursor_scan_number is None:
            last_index = self._scan_index(scan) - 1
            current_level = self._ms_level(scan)
            i = 0
            while last_index >= 0 and i < 100:
                prev_scan = self.get_scan_by_index(last_index)
                if prev_scan.ms_level >= current_level:
                    last_index -= 1
                else:
                    precursor_scan_number = prev_scan._data.scan_number
                    break
                i += 1
        if intensity is None:
            intensity = 0.0
        if mz is None:
            mz = 0.0
        if charge is None or charge == 0:
            charge = ChargeNotProvided
        pinfo = PrecursorInformation(
            mz, intensity, charge, _make_id(precursor_scan_number),
            source=self,
            product_scan_id=_make_id(scan.scan_number))
        return pinfo
예제 #5
0
 def _scan_id(self, scan):
     return _make_id(scan.scan_number)
예제 #6
0
 def _pack_index(self):
     index = OrderedDict()
     for sn in range(self._source.RunHeaderEx.FirstSpectrum - 1,
                     self._source.RunHeaderEx.LastSpectrum):
         index[_make_id(sn)] = sn
     return index
예제 #7
0
 def _scan_id(self, scan):
     scan_number = scan.scan_number
     return _make_id(scan_number + 1)