Comments (11)
the code snippet is here:
#R
.computeBestPeptideSpectrumMatch <- function(rawfile="/Users/cp/Downloads/20180220_14_autoQC01.raw",
pepSeq = c("LGGNEQVTR", "GAGSSEPVTGLDAK", "VEATFGVDESNAK",
"TPVISGGPYEYR", "YILAGVENSK", "TPVITGAPYEYR", "DGLDAASYYAPVR",
"ADVTPADFSEWSK", "GTFIIDPGGVIR", "GTFIIDPAAVIR", "LFLQFGAQGSPFLK"),
peptideMassTolerance = 0.003){
mass2Hplus <- (parentIonMass(pepSeq) + 1.008) / 2
S <- read.raw(rawfile)
S <- S[-which(S$MSOrder != "Ms2"), ]
idx <- lapply(mass2Hplus, function(m){
which(abs(S$PrecursorMass - m) < peptideMassTolerance)
})
# just to be generic correct
scanNumbers <- lapply(idx, function(x){S$scanNumber[x]})
HCDIons <- function (b, y)
{
Hydrogen <- 1.007825
Oxygen <- 15.994915
Nitrogen <- 14.003074
# c <- b + (Nitrogen + (3 * Hydrogen))
# z <- y - (Nitrogen + (3 * Hydrogen))
# return(cbind(b, y,c ,z))
return(cbind(b, y))
}
bestMatchingMS2Scan <- sapply(1:11, function(i){
PL <- readScans(rawfile, scans = scanNumbers[[i]])
pp <- lapply(PL, function(x){psm(pepSeq[i], x, FUN = HCDIons, plot = FALSE)})
score <- sapply(1:length(pp),
function(j){
sum(PL[[j]]$intensity[abs(pp[[j]]$mZ.Da.error) < 0.1])}) #find best scoring spectra
bestFirstMatch <- which(max(score, na.rm = TRUE) == score)[1]
scanNumbers[[i]][bestFirstMatch]
})
bestMatchingMS2Scan
}
from rawdiag.
you ran out of disk space:
you have two options:
-
Do not read all spectra of the rawfile at once.
-
or use the latest version and set the tmp space
install.packages('http://fgcz-ms.uzh.ch/~cpanse/rawDiag_0.0.38.tar.gz', repo=NULL)
from rawdiag.
Hi @NicolasEsk,
that is a good question. I went to the code used for the poster, but I can not determine which rawDiag
version was used. Maybe @cpanse can reveal the secret? :-)
from rawdiag.
we have a self-explaining vignette for computing the matches here:
fgcz-ms.uzh.ch/~cpanse/rawDiagXICdemo.pdf
from rawdiag.
Thanks for both your answers.
Before even trying to integrate that to my code, I went and tried to run the snippet just as is (just changed the rawfile path with a file that works and gives me good results with rawDiag functions).
So I run the snippet you sent, then go back to the poster's code but I get this error, that could be related to just formatting inconsistency? I have limited knowledge in R coding, so it might be something obvious. To be noted, my data is not PRM but DDA.
scanIds <- .computeBestPeptideSpectrumMatch(rawfile, c("LGGNEQVTR", "GAGSSEPVTGLDAK", "VEATFGVDESNAK", "TPVISGGPYEYR", "YILAGVENSK", "TPVITGAPYEYR", "DGLDAASYYAPVR", "ADVTPADFSEWSK", "GTFIIDPGGVIR", "GTFIIDPAAVIR", "LFLQFGAQGSPFLK"), peptideMassTolerance = 0.003)
system2 is writting to tempfile C:\Users\user\AppData\Local\Temp\Rtmp2xSCc3\file6c5834eb2201tsv ...
unlinking C:\Users\user\AppData\Local\Temp\Rtmp2xSCc3\file6c5834eb2201tsv ...
MasterScanNumber calculated
renamed LMmZCorrectionppm to LMCorrection
renamed AGCPSMode to PrescanMode
Error accessing RAWFileReader library! - Error while retrieving centroid peaks for 0. The scan number must be >= 1 and <= 21274.
Memory Usage:
Before 16340 kb, After 111328 kb, Extra 94988 kb
Error in PL[[j]] : subscript out of bounds
In addition: Warning message:
In is.rawDiag(object) :
missing column name(s): MasterScanNumber, LMCorrection, ElapsedScanTimesec, transient, AGCMode, PrescanMode
Called from: FUN(X[[i]], ...)
Error during wrapup: unimplemented type (29) in 'eval'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error during wrapup: INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
from rawdiag.
Perfect, works like a charm now 💯
Thanks for the help, and even more for the package as a whole
Nicolas
from rawdiag.
Salutations
For some obscure reason, last problem is back. Two weeks ago after updating to version 0.0.38, the error disappeared on every raw file I was using as test files.
Now there's a new file, and the problem is back.
scanIds <- .computeBestPeptideSpectrumMatch(rawfile, substr(XICseq, 1, nchar(XICseq) - 3), peptideMassTolerance = 0.02)
Error accessing RAWFileReader library! - Error while retrieving centroid peaks for 0. The scan number must be >= 1 and <= 21116.
Memory Usage:
Before 16424 kb, After 107224 kb, Extra 90800 kb
Error in PL[[j]] : subscript out of bounds
Called from: FUN(X[[i]], ...)
Browse[1]> scans <- readScans(rawfile, scanIds)
Error during wrapup: object 'scanIds' not found
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Don't know if my solution was working then... I added this before my code, is it correct?
rm(list = ls())
write("TMPDIR = 'E:/RTemp'", file=file.path(Sys.getenv('R_USER'), '.Renviron'))
My E drive has 8TB of free space, I don't see how it could be space realted (or maybe Rstudio has a maximum buffer I can change somehow?)
Thank you for your help
Nicolas
from rawdiag.
Hoi Nicolas, This is an R helper function for our poster addressing a targeted approach, namely to detect Biognosis IRT peptides, and it has never been intended to be used for something else. I'm sorry to say you have to debug that function on your own. Good luck, Christian
from rawdiag.
Hi @NicolasEsk ,
does your sample contain any iRT peptides and how was the data recorded (is it PRM)? To me it looks like no, because you request a scan of index 0:
Error while retrieving centroid peaks for 0. The scan number must be >= 1 and <= 21116.
This most likely happens because there are no matching MS2 scans in your data.
from rawdiag.
I am not using iRT as I wanted to adapt the function to my project, but I really think this shouldn't make the script break. I still need more testing but indeed it seems you are right Tobias. I am doing ddMS2 so if the peptide isn't selected for fragmentation, scanNumber will return zeros which are obviously not found as a valid scan number in the next steps of the function. I'll try running PRM runs as soon as possible to keep you updated on the problem.
from rawdiag.
It looks that was it. Error never happened with any of the PRM runs.
Thanks a lot for the precious help
from rawdiag.
Related Issues (20)
- plot.peaklist function does not allow to overwrite title and y- n xlabels
- R 4.0.2 - Error: `x` must be a vector, not a `data.frame/rawDiag` object. HOT 3
- Problems reading Meta Data from QExactive HF / HFX Instruments HOT 28
- Reading Analag Traces from RawFiles HOT 7
- Read additional Infos from Raw Files (Status Log, Tune Method) etc. HOT 10
- create unit test for `read.raw.info()`
- Cannot find dependency "Spectra" HOT 2
- Installation of new RawFileReader files HOT 19
- Error in source(tfo) : negative length vectors are not allowed HOT 15
- replace `warning` with `message`
- Deprecation messages for read.XIC() and readScans() HOT 1
- `funs()` was deprecated in dplyr 0.8.0.
- Error in FUN(left, right) : non-numeric argument to binary operator in `PlotCycleTime` HOT 2
- issues with tempfile opening
- I am trying to run read.raw, but it returns an error HOT 1
- [Extra feature that would be nice] Using m/z / RT values for QCs rather peptides
- protViz 0.6.8 required prior to install rawDiag on R.4.0.5
- Package "mardown" and "plyr" have to be installed so the ShinyApp works
- Problems with the read.raw()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rawdiag.