opentims++
Public Member Functions | Friends | List of all members
TimsDataHandle Class Reference

Public Member Functions

 TimsDataHandle (const std::string &tims_data_dir)
 Open TimsTOF dataset. More...
 
 ~TimsDataHandle ()
 Close and deallocate the TimsTOF data handle (destructor).
 
TimsFrameget_frame (uint32_t frame_no)
 Access a single frame by its ID.
 
const std::unordered_map< uint32_t, TimsFrame > & get_frame_descs ()
 Access a dictionary containing all the frames from this dataset, keyed by ID.
 
size_t no_peaks_total () const
 Returns the total number of MS peaks in this handle.
 
size_t no_peaks_in_frames (const uint32_t indexes[], size_t no_indexes)
 Count the peaks in a subset of frames. More...
 
size_t no_peaks_in_frames (const std::vector< uint32_t > &indexes)
 Count the peaks in a subset of frames. More...
 
size_t no_peaks_in_slice (uint32_t start, uint32_t end, uint32_t step)
 Count the peaks in a subset of frames, selected by a slice. More...
 
uint32_t min_frame_id () const
 Access the lowest id of a valid frame from this dataset.
 
uint32_t max_frame_id () const
 Access the highest id of a valid frame from this dataset.
 
bool has_frame (uint32_t frame_id) const
 Check whether a frame with provided ID exists in the dataset.
 
void extract_frames (const uint32_t *indexes, size_t no_indexes, uint32_t *result)
 This function is deprecated, and left deliberately undocumented; do not use.
 
void extract_frames (const std::vector< uint32_t > &indexes, uint32_t *result)
 This function is deprecated, and left deliberately undocumented; do not use.
 
void extract_frames_slice (uint32_t start, uint32_t end, uint32_t step, uint32_t *result)
 This function is deprecated, and left deliberately undocumented; do not use.
 
void extract_frames (const uint32_t *indexes, size_t no_indexes, uint32_t *frame_ids, uint32_t *scan_ids, uint32_t *tofs, uint32_t *intensities, double *mzs, double *inv_ion_mobilities, double *retention_times)
 This function is deprecated, and left deliberately undocumented; do not use.
 
void extract_frames (const std::vector< uint32_t > &indexes, uint32_t *frame_ids, uint32_t *scan_ids, uint32_t *tofs, uint32_t *intensities, double *mzs, double *inv_ion_mobilities, double *retention_times)
 Extract a subset of frames, selected by indexes, filling provided buffers with MS peak data. More...
 
void extract_frames_slice (uint32_t start, uint32_t end, uint32_t step, uint32_t *frame_ids, uint32_t *scan_ids, uint32_t *tofs, uint32_t *intensities, double *mzs, double *inv_ion_mobilities, double *retention_times)
 Extract a subset of frames, selected by a slice, filling provided buffers with MS peak data. More...
 
void allocate_buffers ()
 
void ensure_buffers_allocated ()
 
void free_buffers ()
 
size_t max_peaks_in_frame ()
 Return the maximal number of peaks in the biggest frame in this dataset.
 
size_t expose_frame (size_t frame_id)
 Expermental API - use discouraged.
 
const std::unique_ptr< uint32_t[]> & scan_ids_buffer ()
 Expermental API - use discouraged.
 
const std::unique_ptr< uint32_t[]> & tofs_buffer ()
 Expermental API - use discouraged.
 
const std::unique_ptr< uint32_t[]> & intensities_buffer ()
 Expermental API - use discouraged.
 

Friends

class BrukerTof2MzConverter
 
class BrukerScan2InvIonMobilityConverter
 
class TimsFrame
 
int tims_sql_callback (void *out, int cols, char **row, char **colnames)
 

Constructor & Destructor Documentation

◆ TimsDataHandle()

TimsDataHandle::TimsDataHandle ( const std::string &  tims_data_dir)

Open TimsTOF dataset.

Open a TimsTOF dataset (read-only access supported). Return a handle using which Tims data may be retrieved.

Parameters
Pathto the dataset (typically a *.d directory, containing a analysis.tdf and analysis.tdf_bin files).

Member Function Documentation

◆ extract_frames()

void TimsDataHandle::extract_frames ( const std::vector< uint32_t > &  indexes,
uint32_t *  frame_ids,
uint32_t *  scan_ids,
uint32_t *  tofs,
uint32_t *  intensities,
double *  mzs,
double *  inv_ion_mobilities,
double *  retention_times 
)
inline

Extract a subset of frames, selected by indexes, filling provided buffers with MS peak data.

The data is saved to the passed buffers - if some of this data is unnecessary, then nullptr may be passed as the corresponding pointer. The buffers are passed and returned by columns. Each row corresponds to one MS peak. Each buffer must be able to hold at least no_peaks_in_frames(indexes) values.

Parameters
indexesSet of indexes of frames for which data is to be obtained.
frame_idsThe IDs of frames containing the associated peaks.
scan_idsIDs of the scan a peak comes from.
tofsTimes of Flight of peaks.
intensitiesSignal intensities of peaks.
mzsM/Z ratios of peaks.
inv_ion_mobilitiesInverse ion mobilities (in seconds).
retention_timesRetention times (in seconds).

◆ extract_frames_slice()

void TimsDataHandle::extract_frames_slice ( uint32_t  start,
uint32_t  end,
uint32_t  step,
uint32_t *  frame_ids,
uint32_t *  scan_ids,
uint32_t *  tofs,
uint32_t *  intensities,
double *  mzs,
double *  inv_ion_mobilities,
double *  retention_times 
)

Extract a subset of frames, selected by a slice, filling provided buffers with MS peak data.

The data is saved to the passed buffers - if some of this data is unnecessary, then nullptr may be passed as the corresponding pointer. The buffers are passed and returned by columns. Each row corresponds to one MS peak. Each buffer must be able to hold at least no_peaks_in_slice(start, stop, end) values.

IDs of the returned frames come from start:stop:step slice.

Parameters
indexesStart of the slice.
endEnd of the slice.
stepStep of the slice.
frame_idsThe IDs of frames containing the associated peaks.
scan_idsIDs of the scan a peak comes from.
tofsTimes of Flight of peaks.
intensitiesSignal intensities of peaks.
mzsM/Z ratios of peaks.
inv_ion_mobilitiesInverse ion mobilities (in seconds).
retention_timesRetention times (in seconds).

◆ no_peaks_in_frames() [1/2]

size_t TimsDataHandle::no_peaks_in_frames ( const std::vector< uint32_t > &  indexes)
inline

Count the peaks in a subset of frames.

Returns the total number of peaks in the frames with given indexes.

Parameters
indexesIndexes of frames to count

◆ no_peaks_in_frames() [2/2]

size_t TimsDataHandle::no_peaks_in_frames ( const uint32_t  indexes[],
size_t  no_indexes 
)

Count the peaks in a subset of frames.

Returns the total number of peaks in the frames with given indexes.

Parameters
indexesIndexes of frames to count
no_indexesNumber of indexes (and length of the indexes[] table).

◆ no_peaks_in_slice()

size_t TimsDataHandle::no_peaks_in_slice ( uint32_t  start,
uint32_t  end,
uint32_t  step 
)

Count the peaks in a subset of frames, selected by a slice.

Returns the total number of peaks in frames with IDs contained in the start:stop:end slice


The documentation for this class was generated from the following file: