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

readSpectrum(...) #2

Open
tobiasko opened this issue Aug 25, 2020 · 16 comments
Open

readSpectrum(...) #2

tobiasko opened this issue Aug 25, 2020 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@tobiasko
Copy link
Collaborator

tobiasko commented Aug 25, 2020

refactor rawDiag::readScans()

arguments

rawfile : path to raw file
scans : numeric vector for selection based on scan index
filter : scan filter for logical selection of scans (e.g. MS, MS2, +, HCD, ...)

returns

S3 object, nested list of type Spectrum (not peaklist)

for FTMS scans the list should contain vectors for: mz, intensity, resolution, noise, charge

In addition header information is needed:

  • raw file
  • scan#
  • RT (Scan Start Time)
  • NL (normalized level = base beak intensity)
  • TIC (Total Ion Current)
  • Base Peak Mass
  • Scan Mode (e.g. FTMS + c NSI Full ms [350.0000 -1800.000]
  • Scan Low Mass
  • Scan High Mass
@tobiasko
Copy link
Collaborator Author

tobiasko commented Aug 25, 2020

Potentially interesting:

==== Diagnostic Data: ==== as shown in Freestyle

contains attributes like AGC Fill, HCD Energy eV, ...

==== Instrument data ==== as shown in Freestyle

contains attributes like Multiple Injection, Charge State, Ion Injection Time (ms), AGC Target, ...

The BIG question: How much scan meta data do we want to extract by default???

@tobiasko
Copy link
Collaborator Author

complete scan header example c&p from Freestyle:

Total Ion Current:	53435.391	
Scan Low Mass:	100	
Scan High Mass:	1335	
Scan Start Time (Min):	20.72	
Scan Number:	12939	
Base Peak Intensity:	6354.29	
Base Peak Mass:	303.27	
Scan Mode:	FTMS + c NSI Full ms2 [email protected] [100.0000-1335.0000]	
======= Instrument data =====	
	
Multiple Injection:	h 	
Multi Inject Info:	IT=55 	
AGC:	On	
Micro Scan Count:	1	
Scan Segment:	1	
Scan Event:	2	
Master Index:	0	
Charge State:	2	
Monoisotopic M/Z:	0.0000	
Ion Injection Time (ms):	55.000	
Max. Ion Time (ms):	55.00	
FT Resolution:	30000	
MS2 Isolation Width:	1.40	
MS2 Isolation Offset:	0.00	
AGC Target:	100000	
HCD Energy:	27.00	
Analyzer Temperature:	30.02	
=== Mass Calibration: ===:	
	
Conversion Parameter B:	211692985.2249	
Conversion Parameter C:	-97213762.9727	
Temperature Comp. (ppm):	-5.72	
RF Comp. (ppm):	-0.22	
Space Charge Comp. (ppm):	-0.01	
Resolution Comp. (ppm):	0.07	
Number of Lock Masses:	2	
Lock Mass #1 (m/z):	371.1010	
Lock Mass #2 (m/z):	445.1200	
Lock Mass #3 (m/z):	0.0000	
LM Search Window (ppm):	15.0	
LM Search Window (mmu):	0.0	
Number of LM Found:	0	
Last Locking (sec):	0.1	
LM m/z-Correction (ppm):	-1.20	
=== Ion Optics Settings: ===:	
	
S-Lens RF Level:	60.00	
S-Lens Voltage (V):	21.00	
Skimmer Voltage (V):	15.00	
Inject Flatapole Offset (V):	5.00	
Bent Flatapole DC (V):	2.00	
MP2 and MP3 RF (V):	633.00	
Gate Lens Voltage (V):	0.88	
C-Trap RF (V):	1010.0	
====  Diagnostic Data:  ====:	
	
Dynamic RT Shift (min):	0.00	
Intens Comp Factor:	0.5575	
Res. Dep. Intens:	1.000	
CTCD NumF:	0	
CTCD Comp:	1.739	
CTCD ScScr:	0.000	
RawOvFtT:	16263.9	
LC FWHM parameter:	15.0	
Rod:	0	
PS Inj. Time (ms):	13.595	
AGC PS Mode:	-2	
AGC PS Diag:	0	
HCD Energy eV:	31.338	
AGC Fill:	0.01	
Injection t0:	0.000	
t0 FLP:	0.00	
Access Id:	0	
Analog Input 1 (V):	0.000	
Analog Input 2 (V):	0.000	

cpanse added a commit that referenced this issue Aug 27, 2020
@cpanse
Copy link
Collaborator

cpanse commented Sep 7, 2020

omit.spectrum = FALSE

@tobiasko
Copy link
Collaborator Author

tobiasko commented Sep 10, 2020

Hi CP,

I checked the details of the current implementation. Currently, some important items are missing in the list/S3 object returned by readSpectrum(...):

*Total Ion Current
*Scan Low Mass
*Scan High Mass
*Base Peak Intensity
*Base Peak Mass

further down the list you should also see a key:value pair ======= Instrument data =====:NA, similar to Mass Calibration, Ion Optics Settings, Diagnostic Data. I could not find it.

Regarding those key:value pairs that are used by thermo to structure the list. Would it be possible to use them as branch points for nesting the list in R?

====  Diagnostic Data:  ====:: chr ""
=== Ion Optics Settings: ===:: chr ""
=== Mass Calibration: ===:: chr ""
=== Instrument data ===:: chr ""

And we should think about where to place the peak lists/attributes in the returned object!

The basic peak list is two numeric vectors:

*position (mz)
*intensity

but there should be additional vectors like:

resolution, noise, charge, background

and the peak flags. As discussed before, maybe having a dedicated object for the peak lists would help, since the vectors would need to stick to certain names, be of equal length and types. omit.spectrum = TRUE would simply not populate this peak list object slot with data.

What do you think?

 sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rawR_0.0.1

loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2   

cpanse added a commit that referenced this issue Sep 15, 2020
@tobiasko
Copy link
Collaborator Author

tobiasko commented Sep 17, 2020

After reading the S3 OOP chapter in Master Hadleys book of whisdom I realized the following: ˋreadSpectrum()ˋ is equal to one of the 3 essential functions, the ˋmyclass()ˋor helper function in case users create class instances. I would therefore rename ˋreadSpectrum()ˋ to ˋSpectrumˋ

@tobiasko
Copy link
Collaborator Author

Or if we incl. the package name in the object name as you suggest ˋrawRSpectrum()ˋ

@tobiasko
Copy link
Collaborator Author

See section 13.3.3 of Hadleys book of wisdom.

@tobiasko
Copy link
Collaborator Author

13.3.3 also answers your question regarding the usage of the validator. The helper function calls the low level constructor ˋnew_myclass() and the validator.

@tobiasko
Copy link
Collaborator Author

The final goal should be that people only interact with two well crafted objects: rawRSpectrum and rawRChromatogram

@tobiasko
Copy link
Collaborator Author

Paper Journal 1

@cpanse
Copy link
Collaborator

cpanse commented Sep 17, 2020 via email

@tobiasko
Copy link
Collaborator Author

image

@cpanse
Copy link
Collaborator

cpanse commented Sep 17, 2020

ahh

@cpanse
Copy link
Collaborator

cpanse commented Sep 17, 2020

brain wash

@tobiasko
Copy link
Collaborator Author

Something I came across:

readChromatogram() returns a rawRchromatogramSet which is basically a list of rawRchromatogram objects.

readSpectrum() behaves differently:

it returns a plain list instead of a rawRspectrumSet.

Could you fix that @cpanse ???

cpanse added a commit that referenced this issue Oct 23, 2020
cpanse added a commit that referenced this issue Oct 26, 2020
@tobiasko
Copy link
Collaborator Author

tobiasko commented Nov 9, 2020

status quo: only peak flags are missing.

@cpanse cpanse added the enhancement New feature or request label Dec 14, 2021
@cpanse cpanse self-assigned this Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants