Hi,
First of all, what a wonderful update with Cardinal 2.2 !
I started to dig into it and, unfortunately, I ran into some issue with some old functions and a piece of code that are no more valid into Cardinal 2 and R 3.6.2 (I was using R version 3.4.4). I want to stay in R 3.6.2 to keep all the new update of Cardinal 2.2 !
I wonder if there is a built-in function in Cardinal 2 to extract the intensity of a series of selected mz and separate them according to their region of interest (ROI). My ROI are already selected and named in flexImaging.
We already had a homemade piece of code to do that, but it used functions that are no more support by Cardinal 2.2 and R 3.6.2. Our output was a table with all the selected mz values and the intensity of all the pixels and the attribution to their respective ROI. This allows us to perform some statistical manipulations with Tidyr packages and visualize these results with ggplot function and separate the result according to their ROI. If a built-in function or code already exists, this will be really helpful!
Thank you for your help,
Frédéric
Here is an example of our problem.
We ran an experiment with 10 sections of a
brain homogenate on which we deposit matrix with 5 different conditions (2
technical duplicates in each row). We want to evaluate which protocol can give the
maximum intensity for some selected mz values. We can surely do that visually
for some on the conditions, but we would like to have some results and show
graphs.
The problem is that we ran most of our analysis in one flexImaging file which doesn’t separate sample by run.
Dataset
An object of class 'MSContinuousImagingExperiment'
<10000 feature, 2117 pixel> imaging dataset
imageData(1): intensity
featureData(0):
pixelData(0):
metadata(11): ibd binary type universally unique identifier ... files name
run(1): 2020_06_10_optiDAN_7-10pass
raster dimensions: 407 x 98
coord(2): x = 158..564, y = 79..176
mass range: 439.9412 to 997.9918
centroided: FALSE
I used select() to separate my dataset in region using x/y position, but I am not able to reattribute the run() .
subset_A = select(data, x<=200,y<=100)subset_A An object of class 'MSContinuousImagingExperiment' <10000 feature, 180 pixel> imaging dataset imageData(1): intensity featureData(0): pixelData(0): metadata(11): ibd binary type universally unique identifier ... files name run(1): 2020_06_10_optiDAN_7-10pass raster dimensions: 12 x 15 coord(2): x = 169..180, y = 79..93 mass range: 439.9412 to 997.9918 centroided: FALSE
Is there way to reattribute the run() name for each region?
Is there a way through Cardinal to automatically recognize and separate the regions?
I try to use meansTest, but it doesn’t run. Is it because I only have one run?
run(dataset) <- as.factor('new_run_name')
meansTest(x, ~ condition, groups=pixelData(x)$run)Hi Gordon,
Thank you for your help ! I was thinking about possible solution way more complex than this one !
I did use your code to update my Dataset’s metadata and it works well!
Unfortunately, I am still running into errors.
My dataset was previously pre-process (normalized, smooth, reduce baseline and peakBin).
Data_binAn object of class 'MSContinuousImagingExperiment' <550 feature, 819 pixel> imaging dataset imageData(1): intensity featureData(0): pixelData(2): position run metadata(11): ibd binary type universally unique identifier ... files name processing complete(4): normalize smoothSignal reduceBaseline peakBin processing pending(0): run(4): 11pass_TOP 11pass_Bottom 7pass_Top 7pass_Bottomraster dimensions: 407 x 92
coord(2): x = 158..564, y = 79..170 mass range: 700.0811 to 899.9101 centroided: TRUE
> pData(Data_bin)
PositionDataFrame with 819 rows and 2 columns :run: coord:x coord:y position run <factor> <integer> <integer> <factor> <factor>1 11pass_TOP 171 82 top 11pass_TOP2 11pass_TOP 178 87 top 11pass_TOP3 11pass_TOP 170 82 top 11pass_TOP4 11pass_TOP 169 93 top 11pass_TOP5 11pass_TOP 179 91 top 11pass_TOP... ... ... ... ... ...815 7pass_Bottom 549 86 top 7pass_Bottom816 7pass_Bottom 559 81 top 7pass_Bottom817 7pass_Bottom 550 79 top 7pass_Bottom818 7pass_Bottom 564 83 top 7pass_Bottom819 7pass_Bottom 559 82 top 7pass_Bottom
The name of the positions are either ‘top’ or ‘bottom’.
The name of the runs are either ‘11pass_top’, ‘11pass_bottom’, ‘7pass_top’ and ‘7pass_bottom’
As you suggest, I tried this line of code : mtest <- meansTest(Data_bin, ~ position , groups= pixelData(Data_bin)$run)
After processing chunk 1-20, I received this error.
|
summary(mtest) Error in as.vector(x, mode = "numeric") : no method for coercing this S4 class to a vector In addition: Warning message: In mean.default(x) : argument is not numeric or logical: returning NA Called from: as.vector(x, mode = "numeric") 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 |
|
|
I used R (v 4.0.1) and Cardinal (v 2.6.0)
Do you have an idea explaining why I am consistently running into this error?
Fred