rickhelmus / patRoon

Workflow solutions for mass-spectrometry based non-target analysis.
https://rickhelmus.github.io/patRoon/
GNU General Public License v3.0
61 stars 18 forks source link

Selection of several adducts #96

Closed Boris-Droz closed 7 months ago

Boris-Droz commented 8 months ago

Hi Rick,

Sorry for this dummy question but I did not find a way to select several positive or negative adducts through the patRoon workflow. If I have the code like:

param.xcms <- xcms::CentWaveParam(ppm = 10,
                              peakwidth = c(5, 45),
                              snthresh = 10,
                              noise = 1E3,
                              prefilter = c(3, 3E3))

fListPos <- findFeatures(anaInfo, "xcms3", param = param.xcms)

fList <- makeSet(fListPos, adducts = c( "[M+H]+") )  

# performed RT alignement
fGroups <- groupFeatures(fList, "xcms3",
                         xcms::PeakDensityParam(sampleGroups = anaInfo$group,
                                                bw=9,
                                                minFraction = 0.5,
                                                minSamples=1,
                                                binSize=0.005,
                                                maxFeatures = 5) )

I tried to change the adducts list as

fList <- makeSet(fListPos, adducts = c( "[M+H]+","[2M+H]+") )  

but get

Error: Assertion on 'adducts' failed: One of the following must apply:
 * checkmate::checkCharacter(adducts): Must be of type 'character', not 'list'
 * checkmate::checkList(adducts): Must have length <= 1, but has length 2.

So, where could I set in the workflow the number of adducts?

Thank you

rickhelmus commented 8 months ago

Hi @Boris-Droz ,

To be sure: what is possible is to assign a different adduct for each feature group. What is currently not possible is to assign multiple adducts to the same feature group in the same set.

Which of the two are you trying to accomplish? :-)

Thanks, Rick

Boris-Droz commented 8 months ago

Hi Rick,

I apologized for the delay, I thought I answer to you.
I used "assign a different adduct for each feature group" in case of merging positive and negative data. And that very convenient.

Today, I try to do the second: "assign multiple adducts to the same feature group in the same set". Is there no way to do this or should I run a multiple of time the same workflow and merge all results at the end?

Let's say I want to have [M+H]+, [2M+H]+ and [M+Na]+analyzed in the same time and the same way.

Thank you again for your time and for your help

Boris

rickhelmus commented 8 months ago

Hi Boris,

Yes, the only the way currently to have multiple adducts assigned to the same feature group is to have separate sets for each of the adduct of interest. However, sets workflows currently don't allow duplicated analysis filenames, so you have to copy/rename the files as well for each set.