-
Notifications
You must be signed in to change notification settings - Fork 25
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
Adding a filterPrecursorCharge() filter function? #192
Comments
Sounds good to me - will it filter on a range or a single value? |
Range would be better indeed. |
Then it's similar to the |
Sure, will do. |
I have this implementation working: > library(rpx)
> px <- PXDataset("PXD000001")
> f <- pxget(px, "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML")
Loading TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML from cache.
> library(Spectra)
> sp <- Spectra(f)
> table(msLevel(sp), precursorCharge(sp))
2 3 4 5 6
1 0 0 0 0 0
2 3749 1955 368 25 6
> sp2 <- filterPrecursorCharge(sp, 2:3)
> table(msLevel(sp2), precursorCharge(sp2))
2 3
2 3749 1955 which however leads me to question the result, which also applies to @jorainer We loose all MS1 spectra, given that we keep those that have a |
I think this depends on the main purpose/use case for the function. I use I think this is also the behaviour users might expect from such a function: if I want to filter by precursor, I will only get those for which the condition (precursor m/z or charge) matches - I might be confused if I get also MS1 spectra in return as they don't have a precursor. But that's only my opinion, happy to discuss. |
feat: new filterPrecursorCharge() method - see issue #192
I agree with you, but this is trivial: x %>%
filterMsLevel(2L) %>%
filterPrecursorMz(c(500, 501)) instead of x %>%
filterPrecursorMz(c(500, 501)) However, the other way is more convoluted (not tested) x <- c(filterMsLevel(x, 1L),
filterPrecursorMz(x, c(500, 501))) and would probably need some rearrangement according to
My use case would be to I keep MS2 scans and have their precursor's scans, to check the precuror peak in its MS1 and look for contaminating ions in the selection window. |
Well, then, the other possibility is to add, like for |
I don't think your suggestion is very elegant, because In general terms, there are two possibilities:
I personally prefer the first option because
|
Note that by adding the Still, I personally don't like option 1) because R in general does either drops Could adding a parameter |
That could be a good compromise indeed. With |
We have this parameter in |
@jorainer - any objection?
The text was updated successfully, but these errors were encountered: