Skip to main content

No project description provided

Project description

imspy - Python package for working with timsTOF raw data

Welcome to the imspy short introduction. This package is designed to work with timsTOF raw data files, which are generated by the Bruker timsTOF mass spectrometers. The package provides a high-level API for accessing raw data, as well as a chemistry module for working with peptide sequences. The package also includes algorithms for ion mobility and retention time prediction, as well as machine learning algorithms for data analysis. Want to see how to build full data processing pipelines with imspy? Check out the imspy_dda and timsim cmd tools as well as our publication pre-print on bioRxiv.

Raw data access

Establish a connection to a timsTOF raw file and access data

import numpy as np
from imspy.timstof import TimsDataset

# you can use in-memory mode for faster access, but it requires more memory
tdf = TimsDataset("path/to/rawfolder.d", in_memory=False)

# show global meta data table
print(tdf.global_meta_data)

# show frame meta data
print(tdf.meta_data)

# get the first frame (bruker frame indices start at 1)
frame = tdf.get_tims_frame(1)

# you can also use indexing
frame = tdf[1]

# print data as pandas dataframe
frame.df()

# get all spectra in a tims frame (sorted by scan = ion mobility)
spectra = frame.to_tims_spectra()

# get a slice of multiple frames
frames = tdf.get_tims_slice(np.array([1, 2, 3]))

# or, by using slicing
frames = tdf[1:4]

DDA data

from imspy.timstof import TimsDatasetDDA
# read a DDA dataset
tdf = TimsDatasetDDA("path/to/rawfolder.d", in_memory=False)

# get raw data of precursors together with their fragment ions
dda_fragments = tdf.get_pasef_fragments()

# the timsTOF re-fragments precursors below a certain intensity threshold,
# you can aggregate the data for increased sensitivity like so:
dda_fragments_grouped = dda_fragments.groupby('precursor_id').agg({
    'frame_id': 'first',
    'time': 'first',
    'precursor_id': 'first',
    # this will sum up the raw data of all fragments with the same precursor_id
    'raw_data': 'sum',
    'scan_begin': 'first',
    'scan_end': 'first',
    'isolation_mz': 'first',
    'isolation_width': 'first',
    'collision_energy': 'first',
    'largest_peak_mz': 'first',
    'average_mz': 'first',
    'monoisotopic_mz': 'first',
    'charge': 'first',
    'average_scan': 'first',
    'intensity': 'first',
    'parent_id': 'first',
})

# for convenience, you can calculate the inverse mobility 
# of the precursor ion by finding the maximum intensity along the scan dimension
mobility = dda_fragments_grouped.apply(
    lambda r: r.raw_data.get_inverse_mobility_along_scan_marginal(), axis=1
)

# add the inverse mobility to the grouped data as a new column
dda_fragments_grouped['mobility'] = mobility

DIA data

from imspy.timstof import TimsDatasetDIA
# read a DIA dataset
tdf = TimsDatasetDIA("path/to/rawfolder.d", in_memory=False)

The chemistry module

Basic usage

</code></pre>
<h3>Working with peptide sequences</h3>
<pre lang="python"><code>

Algorithms and machine learning

ion mobility and retention time prediction

</code></pre>
<h3>Locality sensitive hashing</h3>
<pre lang="python"><code>

Mixture models

</code></pre>
<h2>Pipeline: DDA data analysis (imspy_dda)</h2>
<p>After you successfully installed the package, you can use the <code>imspy_dda</code> command line tool to analyze DDA data.
This will print out a list of options and arguments that you can use to analyze your data:</p>
<pre lang="python"><code>imspy_dda --help

Pipeline: Synthetic raw data generation (timsim)

After you successfully installed the package, you can use the timsim command line tool to generate synthetic raw data. This will print out a list of options and arguments that you can use to generate synthetic raw data:

timsim --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imspy-0.2.31.tar.gz (27.9 MB view details)

Uploaded Source

Built Distribution

imspy-0.2.31-py3-none-any.whl (27.9 MB view details)

Uploaded Python 3

File details

Details for the file imspy-0.2.31.tar.gz.

File metadata

  • Download URL: imspy-0.2.31.tar.gz
  • Upload date:
  • Size: 27.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

File hashes

Hashes for imspy-0.2.31.tar.gz
Algorithm Hash digest
SHA256 299e6d74536dcc9b2abd6778bb35d170e7e29b5eade30c81e63a673ae7576ef5
MD5 e10c7e55a5be0c7be624c36f81249c66
BLAKE2b-256 c7ee393d59dae823c99a16a604f61250e352df72511fb96e3928aec8d1ddb931

See more details on using hashes here.

File details

Details for the file imspy-0.2.31-py3-none-any.whl.

File metadata

  • Download URL: imspy-0.2.31-py3-none-any.whl
  • Upload date:
  • Size: 27.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

File hashes

Hashes for imspy-0.2.31-py3-none-any.whl
Algorithm Hash digest
SHA256 352517f546cde984f2107b47b6c001c2639268a855a1b7bd2661e01db0f65c8d
MD5 ad761d592b1f2ccd0ec0011c640e5562
BLAKE2b-256 e2693743933796de7ab625d848231c7d7fda3a9b755fa7cf80812690a9c05a50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page