fgcz / MsBackendRawFileReader

Spectra MsBackend for Thermo Fisher Scientific's New RawFileReader
https://bioconductor.org/packages/MsBackendRawFileReader/
5 stars 2 forks source link

consider rawFile.IncludeReferenceAndExceptionData = true; #12

Open cpanse opened 4 years ago

cpanse commented 4 years ago

https://github.com/cpanse/MsBackendRawFileReader/blob/63d90b342cce3552b51ccca73b2adcad1eadc3b6/src/MsBackendRawFileReader.cs#L59

#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=false
rawFile.IncludeReferenceAndExceptionData = true;

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

ACK Kapil.Singh@ukbb.ch

tobiasko commented 4 years ago

???

cpanse commented 4 years ago

TODO(@cpanse): check extract list of a peak attributes with the flag for reference, similar to noise.

tobiasko commented 4 years ago
...directly measure and quantify human breath metabolites.
Since we don’t generally have LC connected to our Q Exactive, we 
do all our data analysis using our in-house MATLAB scripts. In 
past two years, I wrote some C++ scripts (with my limited 
knowledge of
C++) using MSFileReader to directly and quickly extract XICs from
thermo’s Raw files for downstream analysis.

But recently, one of our collaborator in Zurich used few of our 
m/z of interest as Lock mass during few patient measurement. Now 
as you know these m/z are removed by default from the thermo’s 
raw file and converted mzXMLs. So I am unable to extract XIC for 
these said masses (I can however see very nice traces in Xcalibur 
when I check “include reference and exception peaks”).

I tried contacting Thermo, but they told me that MSFilereader is 
old and I should use new RawFileReader (which I am unable to do 
due to my limited understanding of .NET, dlls and C).

When I searched on internet I found your R package RawDiag, which 
uses thermos’s new RawFileReader but there also I can’t see XIC 
of my m/z of interest, I guess because by default include 
“IncludeReferenceAndExceptionData” is set to false there.

1.       So could you please help me set 
IncludeReferenceAndExceptionData (it’s a function inside  
thermo’s new
RawFileReader) to true in RawDiag, so I can get XICs for my m/z s 
of interest?

Or

2.       Could you tell me how can make 
IncludeReferenceAndExceptionData (A function also inside  
thermo’s
MSFileReader) works

I am attaching two of my source code, one of them works and other 
one where I added IncludeReferenceAndExceptionData doesn’t 
(*_InProcess.cpp), and I can’t figure out why?
tobiasko commented 4 years ago

Reference Data is most likely a lock mass. Lock mass related parameters are:

"NumberofLockMasses"    
[46] "LockMass1mZ"            "LockMass2mZ"            "LockMass3mZ"           
[49] "LMSearchWindowppm"      "LMSearchWindowmmu"      "NumberofLMFound"       
[52] "LastLockingsec"         "LMmZCorrectionppm"
cpanse commented 4 years ago

using https://bioconductor.org/packages/tartare/ as test data

# library(tartare)

R> rawfile
[1] "/Users/cp/tartare/20190716_004_PierceHeLa.raw"
R> which(S$NumberofLMFound > 0)
[1]  92  93  99 105 111 117 123
tobiasko commented 4 years ago

https://github.com/PNNL-Comp-Mass-Spec/Thermo-Raw-File-Reader/issues/1

tobiasko commented 4 years ago

A code peace from JS UsingRawFileReader.doc, page 21:

/// Gets Flagging information (such as saturated) for each peak
    /// </summary>
    PeakOptions[] Flags { get; }

@cpanse You might try what is returned.