fgcz / msbackendrawfilereader Goto Github PK
View Code? Open in Web Editor NEWSpectra MsBackend for Thermo Fisher Scientific's New RawFileReader
Home Page: https://bioconductor.org/packages/MsBackendRawFileReader/
Spectra MsBackend for Thermo Fisher Scientific's New RawFileReader
Home Page: https://bioconductor.org/packages/MsBackendRawFileReader/
thermo raw files contain lots of metadata in different containers. This issue will deal with how to make them accessible in R using the Spectra
class or a raw specific extension.
https://www.rformassspectrometry.org
does not mention this package at all. There is also no link to your name in the contribution section @cpanse. This should really change!
hi,
i'm getting an error when calling the function 'spectraData()', as follows:
library(MsBackendRawFileReader)
fls <- file.path(path.package(package = 'MsBackendRawFileReader'),
'extdata', 'sample.raw')
be <- backendInitialize(MsBackendRawFileReader(), files = fls, extra=TRUE)
S <- Spectra(be)
S
MSn data (Spectra) with 574 spectra in a MsBackendRawFileReader backend:
filename: /opt/R/R-devel/lib/R/library/MsBackendRawFileReader/extdata/sample.raw
creation date: 2/13/2018 11:09:03 AM
first scan: 1
last scan: 574
model: Q Exactive HF-X Orbitrap
name: Q Exactive HF-X Orbitrap
SerialNumber: Exactive Series slot #6114
Processing:
df <- spectraData(S)
Error in internal <- ccall(obj, fun, list(...)) :
System.ArgumentException: cannot find matching method: getFirstScanNumber, within: MsBackendRawFileReader.Rawfile, requested with 0 params
at bridge.common.reflection.ReflectUtils.CallMethod (System.Object obj, System.String name, System.Object[] parameters) [0x00069] in <91361fa098404b9790c079edab938b6d>:0
at bridge.embedded.CLRBridgeEmbedded.CallMethod (System.Object obj, System.String name, System.Object[] parameters) [0x00001] in <91361fa098404b9790c079edab938b6d>:0
at bridge.server.CLRBridgeServerClient.HandleCallMethod (bridge.server.ctrl.CLRCallMethodMessage req) [0x00022] in <91361fa098404b9790c079edab938b6d>:0
here is the traceback:
traceback()
17: stop(e)
16: value[[3L]](cond)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
14: tryCatchList(expr, classes, parentenv, handlers)
13: tryCatch({
FUN(...)
}, error = handle <- error)
12: withCallingHandlers({
tryCatch({
FUN(...)
}, error = handle <- error)
}, warning = handle <- warning)
11: FUN(...)
10: FUN(X[[i]], ...)
9: lapply(X, FUN <- , ...)
8: bplapply(X, FUN, ..., BPREDO = BPREDO, BPPARAM = param)
7: bplapply(X, FUN, ..., BPREDO = BPREDO, BPPARAM = param)
6: bplapply(split(object@backend, f), function(z, queue) {
.apply <- processing <- queue(as.list(z), msLevel(z), centroided(z),
queue = queue)
}, queue = pqueue, BPPARAM = BPPARAM)
5: bplapply(split(object@backend, f), function(z, queue) {
.apply <- processing <- queue(as.list(z), msLevel(z), centroided(z),
queue = queue)
}, queue = pqueue, BPPARAM = BPPARAM)
4: .peaksapply(object)
3: .local(object, ...)
2: spectraData(S)
Here's my session information:
sessionInfo()
R Under development (unstable) (2019-11-05 r77372)
Platform: x86_64-apple-darwin16.7.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /opt/R/R-devel/lib/R/lib/libRblas.dylib
LAPACK: /opt/R/R-devel/lib/R/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] MsBackendRawFileReader_0.0.2 rDotNet_0.9.1
[3] Spectra_0.3.0 ProtGenerics_1.19.0
[5] IRanges_2.21.2 S4Vectors_0.25.6
[7] BiocGenerics_0.33.0 BiocParallel_1.21.0
[9] nvimcom_0.9-28 colorout_1.2-2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 R6_2.4.1 magrittr_1.5 MsCoreUtils_0.0.2
[5] rlang_0.4.2 testthat_2.3.1 tools_4.0.0 compiler_4.0.0
thanks!!
robert.
#R
# BiocManager::install('cpanse/MsBackendRawFileReader')
library(MsBackendRawFileReader)
rawfile <- "AC0040V1_pos.RAW"
xic5 <- readXICs(rawfile, 143.10666, 5)
xic10 <- readXICs(rawfile, 143.10666, 10)
par(mfrow=c(2,1))
plot(xic5[[1]]$times, xic5[[1]]$intensities, type='l')
plot(xic10[[1]]$times, xic10[[1]]$intensities, type='l')
sessionInfo()
R --no-save < code.R
R> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.4
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats4 parallel stats graphics grDevices utils
[7] datasets methods base
other attached packages:
[1] MsBackendRawFileReader_0.0.4 rDotNet_0.9.1
[3] Spectra_0.3.0 ProtGenerics_1.18.0
[5] IRanges_2.20.2 S4Vectors_0.24.3
[7] BiocGenerics_0.32.0 BiocParallel_1.20.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 R6_2.4.1 magrittr_1.5
[4] MsCoreUtils_0.0.2 rlang_0.4.4 testthat_2.3.1
[7] tools_3.6.2 compiler_3.6.2
R>
rawFile.IncludeReferenceAndExceptionData = false;
rawFile.IncludeReferenceAndExceptionData = true;
The RAW file has data from 1 instruments
General File Information:
RAW file: AC0040V1_pos.RAW
RAW file version: 66
Creation date: 08/13/2019 15:05:45
Operator: ExactiveUser
Number of instruments: 1
Description:
Instrument model: Q Exactive Plus Orbitrap
Instrument name: Q Exactive Plus Orbitrap
Serial number: Exactive Series slot #1234
Software version: 2.9-290204/2.9.3.2948
Firmware version: rev. 1
Units: None
Mass resolution: 0.500
Number of scans: 392
Number of ms2 scans: 0
Scan range: 1 - 392
Time range: 0.01 - 7.75
Mass range: 85.0000 - 600.0000
Sample Information:
Sample name:
Sample id:
Sample type: Unknown
Sample comment:
Sample vial:
Sample volume: 0
Sample injection volume: 0
Sample row number: 0
Sample dilution factor: 0
Filter Information:
Scan filter (first scan): FTMS + p ESI Full lock ms [85.0000-600.0000]
Scan filter (last scan): FTMS + p ESI Full lock ms [85.0000-600.0000]
Total number of filters: 1
Hi @cpanse!
I was trying to expand the spectraData
currently retrieved from the raw files to include relevant variables in Spectra::coreSpectraVariables()
like collisionEnergy
, polarity
, isolationWindow
, etc. For context, our group is currently working with stepped-energy HCD MS2 spectra, but conversion to mzML always removes this info and leaves us with only one collision energy.
From what I've seen, it seems that all this data is in each rawrrSpectrum (ie. not in the header), so my idea would be to retrieve the spectra in groups at some point during .backendInitialize
, extract the relevant information and add it to what's already in the spectraData
DFrame.
Does that sound good? Would you be interested in a PR?
Cheers,
Roger
just for unit testing
Just a note: we've recently renamed the spectraData,MsBackend
method into asDataFrame,MsBackend
. This should not affect your package, since I haven't seen any implementation/usage of this method in your package but I still wanted to let you know.
generate sample.mzXML
use testthat
to compare Spectra objects
MsBackendMzR versus MsBackendRawFileReader
#R
# Orbitrap Fusion Lumos FSN20242
rawfile <- "/Users/cp/Downloads/p2722/stds_pos_neg_MS_highconc_UVPD_50_300.raw"
library(MsBackendRawFileReader)
be <- backendInitialize(MsBackendRawFileReader(), files = rawfile)
(SP <- Spectra(be))
i.p <- Spectra::intensity(SP)
m.p <- Spectra::mz(SP)
SC <- Spectra::pickPeaks(SP)
i.c <- Spectra::intensity(SC)
m.c <- Spectra::mz(SC)
idx.ms2 <- which(msLevel(SP) == 2)
# BiocManager::install('cpanse/protViz')
# protViz package version >= 0.3.6
library(protViz)
rv <- lapply(idx.ms2, function(i){
profile <- data.frame(mZ=m.p[[i]], intensity=i.p[[i]])
rv.protViz <- protViz::centroid(m.p[[i]], i.p[[i]])
rv.spectra <- data.frame(mZ=m.c[[i]], intensity=i.c[[i]])
if (nrow(rv.protViz) == nrow(rv.spectra )){
fit <- lm(rv.protViz$mZ ~ rv.spectra$mZ)
list(profile, rv.protViz, rv.spectra, fit)
}
list(profile, rv.protViz, rv.spectra)
})
In the README file, I saw that you have an internal FGCZ project p3181 application for R MsBackendRawFileReader. I am writing a grant proposal to hire somebody full time on the R for Mass Spectrometry project, and I am asked to mention any existing support related to the project. I would like to know if I can mention the internal application. If so, would it be possible to get the duration and possibly even amount?
Thank you in advance!
Looking at the code of peaksData,MsBackendRawFileReader
it looks like you can extract more than just m/z and intensity values from the raw data files. Is that correct?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.