Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build a tidy raw mass spectrometry data infrastructure (Spectra objects) #21

Open
mikelove opened this issue Jun 25, 2024 · 2 comments
Open

Comments

@mikelove
Copy link
Member

No description provided.

@lgatto
Copy link

lgatto commented Jun 26, 2024

I documented a possible interface between Spectra objects and tables here.

> sciex_file <- dir(system.file("sciex", package = "msdata"), full.names = TRUE)
> sciex <- Spectra(sciex_file, backend = MsBackendMzR())
> sciex ## object of class Spectra
MSn data (Spectra) with 1862 spectra in a MsBackendMzR backend:
       msLevel     rtime scanIndex
     <integer> <numeric> <integer>
1            1     0.280         1
2            1     0.559         2
3            1     0.838         3
4            1     1.117         4
5            1     1.396         5
...        ...       ...       ...
1858         1   258.636       927
1859         1   258.915       928
1860         1   259.194       929
1861         1   259.473       930
1862         1   259.752       931
 ... 33 more variables/columns.

file(s):
20171016_POOL_POS_1_105-134.mzML
20171016_POOL_POS_3_105-134.mzML
> asDataFrame(sciex, i = 1:3, spectraVariables(sciex)[1:3])
DataFrame with 3707 rows and 5 columns
            mz intensity   msLevel     rtime acquisitionNum
     <numeric> <numeric> <integer> <numeric>      <integer>
1      105.043         0         1      0.28              1
2      105.045       412         1      0.28              1
3      105.046         0         1      0.28              1
4      107.055         0         1      0.28              1
5      107.057       412         1      0.28              1
...        ...       ...       ...       ...            ...
3703   133.984         0         1     0.838              3
3704   133.985       132         1     0.838              3
3705   133.987         0         1     0.838              3
3706   133.989       132         1     0.838              3
3707   133.990         0         1     0.838              3

@lgatto
Copy link

lgatto commented Jun 26, 2024

Also note that the functions that operate on Spectra objects can be piped:

x |>
 filterMsLevel(2L) |>
 filterRt(500, 750) |>
 ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants