-
Notifications
You must be signed in to change notification settings - Fork 29
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
Added chromatogramHeader test #302
Conversation
Oh - so there is an issue with indexing? I hope you then also provide a PR with a fix :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great! thank you so much Nils!
quick question: there is not indexing issue with the getAllChromatogramsInfo()
, right? All functions/methods in R for chromatogram extraction pass now R-style 1-based indices, right?
R/methods-mzRpwiz.R
Outdated
@@ -192,10 +191,11 @@ setMethod("chromatogramHeader", "mzRpwiz", | |||
} else { | |||
stopifnot(is.numeric(chrom)) | |||
n <- nChrom(object) | |||
chrom <- as.integer(chrom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be on the (very) save side I would suggest to then call as.integer(chrom)
below (i.e. getChromatogramHeaderInfo(as.integer(chrom))
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be that the Rcpp makes sure the correct type is passed, but I would rather play save...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Yes, correct. The „All“ methods are already using a seq from 1:Nchrom so no need for fixing there. Am 05.02.2025 um 14:42 schrieb Johannes Rainer ***@***.***>:
@jorainer approved this pull request.
Really great! thank you so much Nils!
quick question: there is not indexing issue with the getAllChromatogramsInfo(), right? All functions/methods in R for chromatogram extraction pass now R-style 1-based indices, right?
In R/methods-mzRpwiz.R:
@@ -173,8 +173,7 @@ setMethod("chromatogram", "mzRpwiz",
chrom <- as.integer(chrom)
if (min(chrom) < 1 | max(chrom) > n)
stop("Index out of bound [", 1, ":", n, "].")
- ## Update index to match original indices at the C-level
- chrom <- chrom - 1L
+ # chromatogram index is adjusted in the backend function
yes! agree. that's also what we do for the spectra data.
In R/methods-mzRpwiz.R:
@@ -192,10 +191,11 @@ setMethod("chromatogramHeader", "mzRpwiz",
} else {
stopifnot(is.numeric(chrom))
n <- nChrom(object)
- chrom <- as.integer(chrom)
- if (min(chrom) < 1 || max(chrom) > n)
- stop("Index out of bound [", 1, ":", n, "]")
- chrom <- chrom - 1L
+ cat("n=",n,"min(chrom)=",min(chrom)," max(chrom)=",max(chrom), "\n")
can you please remove the debugging cat() calls here ;)
In R/methods-mzRpwiz.R:
@@ -192,10 +191,11 @@ setMethod("chromatogramHeader", "mzRpwiz",
} else {
stopifnot(is.numeric(chrom))
n <- nChrom(object)
- chrom <- as.integer(chrom)
to be on the (very) save side I would suggest to then call as.integer(chrom) below (i.e. getChromatogramHeaderInfo(as.integer(chrom)))
In R/methods-mzRpwiz.R:
@@ -192,10 +191,11 @@ setMethod("chromatogramHeader", "mzRpwiz",
} else {
stopifnot(is.numeric(chrom))
n <- nChrom(object)
- chrom <- as.integer(chrom)
could be that the Rcpp makes sure the correct type is passed, but I would rather play save...
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Before merging, let me check that the |
R/methods-mzRpwiz.R
Outdated
@@ -192,10 +191,11 @@ setMethod("chromatogramHeader", "mzRpwiz", | |||
} else { | |||
stopifnot(is.numeric(chrom)) | |||
n <- nChrom(object) | |||
chrom <- as.integer(chrom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Unsure whether I messed up merging, but I am getting a test failure: Line 153 in 30d1676
assumes the TIC is always the first chromatogram() . Is that guaranteed, quite common or just in our MRM file ?Yours, Steffen |
AFAIK the TIC is always the first chromatogram in the chromatogram list entry of a mzML file - as far that is what I've seen so far. But Nils @nilshoffmann will definitely have more data files seen to give a better/more reliable answer. |
First step to demonstrate issues with index access for chromatogramHeader vs chromatogram.