imspy.timstof package¶
Subpackages¶
- imspy.timstof.dbsearch package
- Submodules
- imspy.timstof.dbsearch.imspy_dda module
- imspy.timstof.dbsearch.imspy_rescore_sage module
- imspy.timstof.dbsearch.sage_output_utility module
- imspy.timstof.dbsearch.utility module
check_memory()
extract_timstof_dda_data()
generate_balanced_im_dataset()
generate_balanced_rt_dataset()
generate_training_data()
get_searchable_spec()
linear_map()
list_to_semicolon_string()
map_to_domain()
merge_dicts_with_merge_dict()
parse_string_list()
parse_to_tims2rescore()
peptide_length()
sanitize_charge()
sanitize_mz()
split_fasta()
split_psms()
transform_psm_to_pin()
write_psms_binary()
- Module contents
Submodules¶
imspy.timstof.collision module¶
- class imspy.timstof.collision.TimsTofCollisionEnergy¶
Bases:
object
- abstractmethod get_collision_energies()¶
- Return type:
list
[float
]
- abstractmethod get_collision_energy()¶
- Return type:
float
- class imspy.timstof.collision.TimsTofCollisionEnergyDIA(frame, frame_window_group, window_group, scan_start, scan_end, collision_energy)¶
Bases:
TimsTofCollisionEnergy
- get_collision_energies(frame_ids, scan_ids)¶
- Return type:
list
[float
]
- get_collision_energy(frame_id, scan_id)¶
- Return type:
float
imspy.timstof.data module¶
- class imspy.timstof.data.AcquisitionMode(mode)¶
Bases:
RustWrapperObject
- classmethod from_py_ptr(ptr)¶
Get an AcquisitionMode from a pointer.
- Parameters:
ptr (pims.AcquisitionMode) – Pointer to an acquisition mode.
- Returns:
Acquisition mode.
- Return type:
- get_py_ptr()¶
- property mode: str¶
Get the acquisition mode.
- Returns:
Acquisition mode.
- Return type:
str
- class imspy.timstof.data.TimsDataset(data_path, in_memory=False, use_bruker_sdk=True)¶
Bases:
ABC
- property acquisition_mode: str¶
Get the acquisition mode.
- Returns:
Acquisition mode.
- Return type:
str
- property acquisition_mode_numeric: int¶
Get the acquisition mode as a numerical value.
- Returns:
Acquisition mode as a numerical value.
- Return type:
int
- property average_cycle_length: float¶
- bytes_to_indexed_values(values)¶
Convert bytes to scan, tof, and intensity values.
- Parameters:
values (NDArray[np.uint8]) – Bytes.
- Returns:
Scan values. NDArray[np.int32]: TOF values. NDArray[np.float64]: Intensity values.
- Return type:
NDArray[np.int32]
- compress_frames(frames, num_threads=4)¶
Compress a collection of frames.
- Parameters:
frames (List[TimsFrame]) – List of frames.
num_threads (int) – Number of threads to use.
- Returns:
List of compressed bytes.
- Return type:
List[NDArray[np.uint8]]
- compress_zstd(values)¶
Compress values using ZSTD.
- Parameters:
values (NDArray[np.float64]) – Values to compress.
- Returns:
Compressed values.
- Return type:
NDArray[np.uint8]
- decompress_zstd(values, ignore_first_n=8)¶
Decompress values using ZSTD.
- Parameters:
values (NDArray[np.float64]) – Values to decompress.
ignore_first_n (int) – Number of bytes to ignore.
- Returns:
Decompressed values.
- Return type:
NDArray[np.uint8]
- property description: str¶
- property frame_count: int¶
Get the number of frames.
- Returns:
Number of frames.
- Return type:
int
- get_table(table_name)¶
Get a table.
- Parameters:
table_name (str) – Table name.
- Returns:
Table.
- Return type:
pd.DataFrame
- get_tims_frame(frame_id)¶
Get a TimsFrame.
- Parameters:
frame_id (int) – Frame ID.
- Returns:
TimsFrame.
- Return type:
- get_tims_slice(frame_ids, num_threads=8)¶
Get a TimsFrame.
- Parameters:
frame_ids (int) – Frame ID.
num_threads (int) – Number of threads.
- Returns:
TimsFrame.
- Return type:
- property im_lower¶
- property im_upper¶
- indexed_values_to_compressed_bytes(scan_values, tof_values, intensity_values, total_scans)¶
Convert scan and intensity values to bytes.
- Parameters:
scan_values (NDArray[np.int32]) – Scan values.
tof_values (NDArray[np.int32]) – TOF values.
intensity_values (NDArray[np.float64]) – Intensity values.
total_scans (int) – Total number of scans.
- Returns:
Bytes.
- Return type:
NDArray[np.uint8]
- inverse_mobility_to_scan(frame_id, im_values)¶
Convert inverse mobility values to scan values.
- Parameters:
frame_id (int) – Frame ID.
im_values (NDArray[np.float64]) – Inverse mobility values.
- Returns:
Scan values.
- Return type:
NDArray[np.int32]
- property mz_lower¶
- mz_to_tof(frame_id, mz_values)¶
Convert m/z values to TOF values.
- Parameters:
frame_id (int) – Frame ID.
mz_values (NDArray[np.float64]) – m/z values.
- Returns:
TOF values.
- Return type:
NDArray[np.int32]
- property mz_upper¶
- property num_scans: int¶
Get the number of scans.
- Returns:
Number of scans.
- Return type:
int
- scan_to_inverse_mobility(frame_id, scan_values)¶
Convert scan values to inverse mobility values.
- Parameters:
frame_id (int) – Frame ID.
scan_values (NDArray[np.int32]) – Scan values.
- Returns:
Inverse mobility values.
- Return type:
NDArray[np.float64]
- tof_to_mz(frame_id, tof_values)¶
Convert TOF values to m/z values.
- Parameters:
frame_id (int) – Frame ID.
tof_values (NDArray[np.int32]) – TOF values.
- Returns:
m/z values.
- Return type:
NDArray[np.float64]
- imspy.timstof.data.is_amd64()¶
imspy.timstof.dda module¶
- class imspy.timstof.dda.FragmentDDA(frame_id, precursor_id, collision_energy, selected_fragment)¶
Bases:
RustWrapperObject
- property collision_energy: float¶
- property frame_id: int¶
- classmethod from_py_ptr(fragment)¶
- get_py_ptr()¶
- property precursor_id: int¶
- class imspy.timstof.dda.PrecursorDDA(frame_id, precursor_id, highest_intensity_mz, average_mz, inverse_ion_mobility, collision_energy, precuror_total_intensity, isolation_mz, isolation_width, mono_mz=None, charge=None)¶
Bases:
RustWrapperObject
- property average_mz: float¶
- property charge: int | None¶
- property collision_energy: float¶
- property frame_id: int¶
- classmethod from_py_ptr(precursor)¶
- get_py_ptr()¶
- property highest_intensity_mz: float¶
- property inverse_ion_mobility: float¶
- property isolation_mz: float¶
- property isolation_width: float¶
- property mono_mz: float | None¶
- property precuror_total_intensity: float¶
- property precursor_id: int¶
- to_sage_precursor()¶
- Return type:
Precursor
- class imspy.timstof.dda.TimsDatasetDDA(data_path, in_memory=False, use_bruker_sdk=True)¶
Bases:
TimsDataset
,RustWrapperObject
- classmethod from_py_ptr(ptr)¶
- get_pasef_fragments(num_threads=1)¶
Get PASEF fragments.
Args: num_threads (int, optional): Number of threads. Defaults to 1. CAUTION: As long as connection to datasets is established via bruker so / dll, using multiple threads is unstable.
- Returns:
List of PASEF fragments.
- Return type:
List[FragmentDDA]
- get_precursor_frames(min_intensity=75, max_peaks=500, num_threads=4)¶
Get precursor frames. :type min_intensity:
float
:param min_intensity: minimum intensity a peak must have to be considered :type max_peaks:int
:param max_peaks: maximum number of peaks to consider, frames will be sorted by intensity and only the top max_peaks will be considered :type num_threads:int
:param num_threads: number of threads to use for processing- Returns:
List of all precursor frames
- Return type:
List[TimsFrame]
- get_py_ptr()¶
- get_sage_processed_precursors(min_intensity=75, max_peaks=5000, file_id=0, num_threads=16)¶
- Return type:
List
[ProcessedSpectrum
]
- get_selected_precursors()¶
Get meta data for all selected precursors :returns: List of all selected precursors :rtype: List[PrecursorDDA]
imspy.timstof.dia module¶
- class imspy.timstof.dia.TimsDatasetDIA(data_path, in_memory=False, use_bruker_sdk=True)¶
Bases:
TimsDataset
,RustWrapperObject
- property dia_ms_ms_info¶
Get DIA MS/MS info.
- Returns:
DIA MS/MS info.
- Return type:
pd.DataFrame
- property dia_ms_ms_windows¶
Get PASEF meta data for DIA.
- Returns:
PASEF meta data.
- Return type:
pd.DataFrame
- classmethod from_py_ptr(obj)¶
- get_py_ptr()¶
- read_compressed_data_full()¶
Read compressed data.
- Returns:
Compressed data.
- Return type:
List[bytes]
- sample_fragment_signal(num_frames, window_group, max_intensity=25.0, take_probability=0.5)¶
Sample fragment signal.
- Parameters:
num_frames (
int
) – Number of frames.window_group (
int
) – Window group to take frames from.max_intensity (
float
) – Maximum intensity.take_probability (
float
) – Probability to take signals from sampled frames.
- Returns:
Frame.
- Return type:
- sample_precursor_signal(num_frames, max_intensity=25.0, take_probability=0.5)¶
Sample precursor signal.
- Parameters:
num_frames (
int
) – Number of frames.max_intensity (
float
) – Maximum intensity.take_probability (
float
) – Probability to take signals from sampled frames.
- Returns:
Frame.
- Return type:
imspy.timstof.frame module¶
- class imspy.timstof.frame.TimsFrame(frame_id, ms_type, retention_time, scan, mobility, tof, mz, intensity)¶
Bases:
RustWrapperObject
- property df: DataFrame¶
Data as a pandas DataFrame.
- Returns:
Data.
- Return type:
pd.DataFrame
- filter(mz_min=0.0, mz_max=2000.0, scan_min=0, scan_max=1000, mobility_min=0.0, mobility_max=2.0, intensity_min=0.0, intensity_max=1000000000.0)¶
Filter the frame for a given m/z range, scan range and intensity range.
- Parameters:
mz_min (float) – Minimum m/z value.
mz_max (float) – Maximum m/z value.
scan_min (int, optional) – Minimum scan value. Defaults to 0.
scan_max (int, optional) – Maximum scan value. Defaults to 1000.
mobility_min (float, optional) – Minimum inverse mobility value. Defaults to 0.0.
mobility_max (float, optional) – Maximum inverse mobility value. Defaults to 2.0.
intensity_min (float, optional) – Minimum intensity value. Defaults to 0.0.
intensity_max (float, optional) – Maximum intensity value. Defaults to 1e9.
- Returns:
Filtered frame.
- Return type:
- property frame_id: int¶
Frame ID.
- Returns:
Frame ID.
- Return type:
int
- classmethod from_py_ptr(frame)¶
Create a TimsFrame from a PyTimsFrame.
- Parameters:
frame (pims.PyTimsFrame) – PyTimsFrame to create the TimsFrame from.
- Returns:
TimsFrame created from the PyTimsFrame.
- Return type:
- classmethod from_tims_spectra(spectra)¶
Create a TimsFrame from a list of TimsSpectrum.
- Parameters:
spectra (List[TimsSpectrum]) – List of TimsSpectrum.
- Returns:
TimsFrame created from the TimsSpectrum.
- Return type:
- classmethod from_windows(windows)¶
Create a TimsFrame from a list of windows.
- Parameters:
windows (List[TimsSpectrum]) – List of windows.
- Returns:
TimsFrame created from the windows.
- Return type:
- get_inverse_mobility_along_scan_marginal()¶
Get the inverse mobility along the scan marginal.
- Returns:
Inverse mobility.
- Return type:
float
- get_mobility_mean_and_variance()¶
Get the mean and variance of the inverse mobility.
- Returns:
Mean and variance of the inverse mobility.
- Return type:
Tuple[float, float]
- get_py_ptr()¶
- property intensity: ndarray[Any, dtype[float64]]¶
Intensity.
- Returns:
Intensity.
- Return type:
NDArray[np.float64]
- property mobility: ndarray[Any, dtype[float64]]¶
Inverse mobility.
- Returns:
Inverse mobility.
- Return type:
NDArray[np.float64]
- property ms_type: int¶
MS type.
- Returns:
MS type.
- Return type:
int
- property ms_type_as_string: str¶
MS type.
- Returns:
MS type.
- Return type:
int
- property mz: ndarray[Any, dtype[float64]]¶
m/z.
- Returns:
m/z.
- Return type:
NDArray[np.float64]
- random_subsample_frame(take_probability)¶
Randomly subsample the frame.
Args: take_probability (float): Take probability.
Returns: TimsFrame: Subsampled frame.
- Return type:
- property retention_time: float¶
Retention time.
- Returns:
Retention time.
- Return type:
float
- property scan: ndarray[Any, dtype[int32]]¶
Scan.
- Returns:
Scan.
- Return type:
NDArray[np.int32]
- to_dense_windows(window_length=10, resolution=1, overlapping=True, min_num_peaks=5, min_intensity=0.0)¶
- Return type:
ndarray
[Any
,dtype
[float64
]]
- to_indexed_mz_spectrum()¶
Convert the frame to an IndexedMzSpectrum.
- Returns:
IndexedMzSpectrum.
- Return type:
- to_noise_annotated_tims_frame()¶
Convert the frame to a noise annotated frame.
- Returns:
Noise annotated frame.
- Return type:
- to_resolution(resolution)¶
Convert the frame to a given resolution.
- Parameters:
resolution (int) – Resolution.
- Returns:
Frame with the given resolution.
- Return type:
- to_tims_spectra()¶
Convert the frame to a list of TimsSpectrum.
- Returns:
List of TimsSpectrum.
- Return type:
List[TimsSpectrum]
- to_windows(window_length=10, overlapping=True, min_num_peaks=5, min_intensity=1)¶
Convert the frame to a list of windows.
- Parameters:
window_length (float, optional) – Window length. Defaults to 10.
overlapping (bool, optional) – Whether the windows should overlap. Defaults to True.
min_num_peaks (int, optional) – Minimum number of peaks in a window. Defaults to 5.
min_intensity (float, optional) – Minimum intensity of a peak in a window. Defaults to 1.
- Returns:
List of windows.
- Return type:
List[MzSpectrum]
- property tof: ndarray[Any, dtype[int32]]¶
Time of flight.
- Returns:
Time of flight.
- Return type:
NDArray[np.int32]
- vectorized(resolution=2)¶
Convert the frame to a vectorized frame.
- Parameters:
resolution (int, optional) – Resolution. Defaults to 2.
- Returns:
Vectorized frame.
- Return type:
- class imspy.timstof.frame.TimsFrameVectorized(frame_id, ms_type, retention_time, scan, mobility, tof, indices, intensity)¶
Bases:
RustWrapperObject
- property df: DataFrame¶
Data as a pandas DataFrame.
- Returns:
Data.
- Return type:
pd.DataFrame
- filter(mz_min=0.0, mz_max=2000.0, scan_min=0, scan_max=1000, mobility_min=0.0, mobility_max=2.0, intensity_min=0.0, intensity_max=1000000000.0)¶
Filter the frame for a given m/z range, scan range and intensity range.
- Parameters:
mz_min (float) – Minimum m/z value.
mz_max (float) – Maximum m/z value.
scan_min (int, optional) – Minimum scan value. Defaults to 0.
scan_max (int, optional) – Maximum scan value. Defaults to 1000.
mobility_min (float, optional) – Minimum inverse mobility value. Defaults to 0.0.
mobility_max (float, optional) – Maximum inverse mobility value. Defaults to 2.0.
intensity_min (float, optional) – Minimum intensity value. Defaults to 0.0.
intensity_max (float, optional) – Maximum intensity value. Defaults to 1e9.
- Returns:
Filtered frame.
- Return type:
- property frame_id: int¶
Frame ID.
- Returns:
Frame ID.
- Return type:
int
- classmethod from_py_ptr(frame)¶
Create a TimsFrameVectorized from a PyTimsFrameVectorized.
- Parameters:
frame (pims.PyTimsFrameVectorized) – PyTimsFrameVectorized to create the TimsFrameVectorized from.
- Returns:
TimsFrameVectorized created from the PyTimsFrameVectorized.
- Return type:
- get_arrays_at_index(index)¶
Get the arrays at a given index.
- Parameters:
index (int) – Index.
- Returns:
Arrays at the index.
- Return type:
NDArray[np.float64]
- get_py_ptr()¶
- get_tensor_repr(dense=True, zero_indexed=True, re_index=True, scan_max=None, index_max=None)¶
- property indices: ndarray[Any, dtype[int32]]¶
Indices.
- Returns:
Indices.
- Return type:
NDArray[np.int32]
- property intensity: ndarray[Any, dtype[float64]]¶
Intensity.
- Returns:
Intensity.
- Return type:
NDArray[np.float64]
- property mobility: ndarray[Any, dtype[float64]]¶
Inverse mobility.
- Returns:
Inverse mobility.
- Return type:
NDArray[np.float64]
- property ms_type: str¶
MS type.
- Returns:
MS type.
- Return type:
int
- property retention_time: float¶
Retention time.
- Returns:
Retention time.
- Return type:
float
- property scan: ndarray[Any, dtype[int32]]¶
Scan.
- Returns:
Scan.
- Return type:
NDArray[np.int32]
- property tof: ndarray[Any, dtype[int32]]¶
Time of flight.
- Returns:
Time of flight.
- Return type:
NDArray[np.int32]
imspy.timstof.quadrupole module¶
- class imspy.timstof.quadrupole.TimsTofQuadrupoleDIA(frame, frame_window_group, window_group, scan_start, scan_end, isolation_mz, isolation_width, k=None)¶
Bases:
object
- all_transmitted(frame_id, scan_id, mz, min_proba=None)¶
- Return type:
bool
- any_transmitted(frame_id, scan_id, mz, min_proba=None)¶
- Return type:
bool
- apply_transmission(frame_id, scan_id, mz)¶
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- frame_to_window_group(frame_id)¶
- Return type:
int
- get_transmission_set(frame_id, scan_id, mz, min_proba=None)¶
- Return type:
set
[int
]
- is_precursor(frame_id)¶
- Return type:
bool
- is_transmitted(frame_id, scan_id, mz, min_proba=None)¶
- Return type:
bool
- isotopes_transmitted(frame_id, scan_id, mz_mono, mz, min_proba=None)¶
Get the transmission probability for a list of isotopes :type frame_id:
int
:param frame_id: :type scan_id:int
:param scan_id: :type mz_mono:float
:param mz_mono: :type mz:ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]] :param mz: :type min_proba:float
|None
:param min_proba:Returns:
- Return type:
tuple
[float
,list
[tuple
[float
,float
]]]
- transmit_ion(frame_ids, scan_ids, spectrum, min_probability)¶
- Return type:
List
[List
[MzSpectrum
]]
- transmit_spectrum(frame_id, scan_id, spectrum, min_probability=None)¶
- Return type:
imspy.timstof.slice module¶
- class imspy.timstof.slice.TimsPlane¶
Bases:
object
- property df¶
- property frame_ids¶
- classmethod from_py_tims_plane(plane)¶
Create a TimsPlane from a PyTimsPlane.
- Parameters:
plane (pims.PyTimsPlane) – PyTimsPlane to create the TimsPlane from.
- Returns:
TimsPlane created from the PyTimsPlane.
- Return type:
- property intensities¶
- property mobilities¶
- property mz_mean¶
- property mz_std¶
- property num_points¶
- property retention_times¶
- property scans¶
- property tof_mean¶
- property tof_std¶
- class imspy.timstof.slice.TimsSlice(frame_id, scan, tof, retention_time, mobility, mz, intensity)¶
Bases:
object
- property df: DataFrame¶
Get the data as a pandas DataFrame.
- Returns:
Data.
- Return type:
pd.DataFrame
- filter(mz_min=0.0, mz_max=2000.0, scan_min=0, scan_max=1000, mobility_min=0.0, mobility_max=2.0, intensity_min=0.0, intensity_max=1000000000.0, num_threads=4)¶
Filter the slice by m/z, scan and intensity.
- Parameters:
mz_min (float) – Minimum m/z value.
mz_max (float) – Maximum m/z value.
scan_min (int, optional) – Minimum scan value. Defaults to 0.
scan_max (int, optional) – Maximum scan value. Defaults to 1000.
mobility_min (float, optional) – Minimum inverse mobility value. Defaults to 0.0.
mobility_max (float, optional) – Maximum inverse mobility value. Defaults to 2.0.
intensity_min (float, optional) – Minimum intensity value. Defaults to 0.0.
intensity_max (float, optional) – Maximum intensity value. Defaults to 1e9.
num_threads (int, optional) – Number of threads to use. Defaults to 4.
- Returns:
Filtered slice.
- Return type:
- filter_by_type(mz_min_ms1=0, mz_max_ms1=2000, scan_min_ms1=0, scan_max_ms1=1000, inv_mob_min_ms1=0, inv_mob_max_ms1=2, intensity_min_ms1=0, intensity_max_ms1=1000000000.0, mz_min_ms2=0, mz_max_ms2=2000, scan_min_ms2=0, scan_max_ms2=1000, inv_mob_min_ms2=0, inv_mob_max_ms2=2, intensity_min_ms2=0, intensity_max_ms2=1000000000.0, num_threads=4)¶
Filter the slice by m/z, scan and intensity, for MS1 and MS2 with different ranges.
- Parameters:
mz_min_ms1 (float, optional) – Minimum m/z value for MS1. Defaults to 0.
mz_max_ms1 (float, optional) – Maximum m/z value for MS1. Defaults to 2000.
scan_min_ms1 (int, optional) – Minimum scan value for MS1. Defaults to 0.
scan_max_ms1 (int, optional) – Maximum scan value for MS1. Defaults to 1000.
inv_mob_min_ms1 (float, optional) – Minimum inverse mobility value for MS1. Defaults to 0.
inv_mob_max_ms1 (float, optional) – Maximum inverse mobility value for MS1. Defaults to 2.
intensity_min_ms1 (float, optional) – Minimum intensity value for MS1. Defaults to 0.
intensity_max_ms1 (float, optional) – Maximum intensity value for MS1. Defaults to 1e9.
mz_min_ms2 (float, optional) – Minimum m/z value for MS2. Defaults to 0.
mz_max_ms2 (float, optional) – Maximum m/z value for MS2. Defaults to 2000.
scan_min_ms2 (int, optional) – Minimum scan value for MS2. Defaults to 0.
scan_max_ms2 (int, optional) – Maximum scan value for MS2. Defaults to 1000.
inv_mob_min_ms2 (float, optional) – Minimum inverse mobility value for MS2. Defaults to 0.
inv_mob_max_ms2 (float, optional) – Maximum inverse mobility value for MS2. Defaults to 2.
intensity_min_ms2 (float, optional) – Minimum intensity value for MS2. Defaults to 0.
intensity_max_ms2 (float, optional) – Maximum intensity value for MS2. Defaults to 1e9.
num_threads (int, optional) – Number of threads to use. Defaults to 4.
- Returns:
Filtered slice.
- Return type:
- property first_frame_id: int¶
First frame ID.
- Returns:
First frame ID.
- Return type:
int
- property fragments¶
- classmethod from_frames(frames)¶
Create a TimsSlice from a list of TimsFrames.
- classmethod from_py_tims_slice(tims_slice)¶
Create a TimsSlice from a PyTimsSlice.
- Parameters:
tims_slice (pims.PyTimsSlice) – PyTimsSlice to create the TimsSlice from.
- Returns:
TimsSlice created from the PyTimsSlice.
- Return type:
- property last_frame_id: int¶
Last frame ID.
- Returns:
Last frame ID.
- Return type:
int
- property precursors¶
- to_dense_windows(window_length=10, resolution=1, overlapping=True, min_num_peaks=5, min_intensity=0.0, num_theads=4)¶
- Return type:
tuple
[list
[ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]],list
[ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]],list
[ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]]]
- to_resolution(resolution, num_threads=4)¶
Convert the slice to a given resolution.
- Parameters:
resolution (int) – Resolution.
num_threads (int, optional) – Number of threads to use. Defaults to 4.
- Returns:
Slice with given resolution.
- Return type:
- to_windows(window_length=10, overlapping=True, min_num_peaks=5, min_intensity=1, num_threads=4)¶
Convert the slice to a list of windows.
- Parameters:
window_length (float, optional) – Window length. Defaults to 10.
overlapping (bool, optional) – Whether the windows should overlap. Defaults to True.
min_num_peaks (int, optional) – Minimum number of peaks in a window. Defaults to 5.
min_intensity (float, optional) – Minimum intensity of a peak in a window. Defaults to 1.
num_threads (int, optional) – Number of threads to use. Defaults to 1.
- Returns:
List of windows.
- Return type:
List[MzSpectrum]
- vectorized(resolution=2, num_threads=4)¶
Get a vectorized version of the slice.
- Parameters:
resolution (int, optional) – Resolution. Defaults to 2.
num_threads (int, optional) – Number of threads to use. Defaults to 4.
- Returns:
Vectorized version of the slice.
- Return type:
- class imspy.timstof.slice.TimsSliceVectorized¶
Bases:
object
- property df: DataFrame¶
Get the data as a pandas DataFrame.
- Returns:
Data.
- Return type:
pd.DataFrame
- filter(mz_min=0.0, mz_max=2000.0, scan_min=0, scan_max=1000, mobility_min=0.0, mobility_max=2.0, intensity_min=0.0, intensity_max=1000000000.0, num_threads=4)¶
Filter the slice by m/z, scan and intensity.
- Parameters:
mz_min (float) – Minimum m/z value.
mz_max (float) – Maximum m/z value.
scan_min (int, optional) – Minimum scan value. Defaults to 0.
scan_max (int, optional) – Maximum scan value. Defaults to 1000.
mobility_min (float, optional) – Minimum inverse mobility value. Defaults to 0.0.
mobility_max (float, optional) – Maximum inverse mobility value. Defaults to 2.0.
intensity_min (float, optional) – Minimum intensity value. Defaults to 0.0.
intensity_max (float, optional) – Maximum intensity value. Defaults to 1e9.
num_threads (int, optional) – Number of threads to use. Defaults to 4.
- Returns:
Filtered slice.
- Return type:
- property first_frame_id: int¶
First frame ID.
- Returns:
First frame ID.
- Return type:
int
- property fragments¶
- property frames: List[TimsFrameVectorized]¶
Get the frames.
- Returns:
Frames.
- Return type:
List[TimsFrame]
- classmethod from_vectorized_py_tims_slice(tims_slice)¶
Create a TimsSlice from a PyTimsSlice.
- Parameters:
tims_slice (pims.PyTimsSlice) – PyTimsSlice to create the TimsSlice from.
- Returns:
TimsSlice created from the PyTimsSlice.
- Return type:
- get_py_ptr()¶
- get_tensor_repr(dense=True, zero_index=True, re_index=True, frame_max=None, scan_max=None, index_max=None)¶
- property last_frame_id: int¶
Last frame ID.
- Returns:
Last frame ID.
- Return type:
int
- property precursors¶