The vanKrevelenCognostics function provides a set of default cognostics to be used with Van Krevelen plots in Trelliscope. The vanKrevelenCognostics function accepts the boundary set used for Van Krevelen class calculations and (for comparisonSummary objects only) the name of the column to use for identifying which peaks are observed in which group. It returns a function that may be applied to each ftmsData object, as is appropriate for use with the makeDisplay function. See Examples section for use.

vanKrevelenCognostics(vkBoundarySet = "bs1", uniquenessColName = NA)

Arguments

vkBoundarySet

Van Krevelen boundary set to use for calculating class proportions

uniquenessColName

if ftmsObj is a group comparison summary object, what is the name of the column that specifies uniqueness to a group? If only one uniqueness function has been applied this is unnecessary. (See summarizeGroupComparisons.)

Value

a function that may be applied to objects of type peakData,

groupSummary, and comparisonSummary

Examples

if (FALSE) {
library(ftmsRanalysis)
library(trelliscope)

vdbDir <- vdbConn(file.path(tempdir(), "trell_test"), autoYes = TRUE)
data('exampleProcessedPeakData')

## Van Krevelen plot for each sample
sampleDdo <- divideBySample(exampleProcessedPeakData)
panelFn1 <- panelFunctionGenerator("vanKrevelenPlot", vkBoundarySet="bs2", title="Test")

# Note: make sure the same vkBoundarySet value is provided to the panel and cognostics functions
makeDisplay(sampleDdo,
         panelFn=panelFn1,
         cogFn=vanKrevelenCognostics(vkBoundarySet="bs2"),
         name = "Van_Krevelen_plots_per_sample")

## Van Krevelen plots for group comparison summaries
grpCompDdo <- divideByGroupComparisons(exampleProcessedPeakData, "all")
grpCompSummaryDdo <- summarizeGroupComparisons(
                       grpCompDdo, 
                       summary_functions="uniqueness_gtest",
                       summary_function_params=list(uniqueness_gtest=list(
                                                 pres_fn="nsamps", 
                                                 pres_thresh=2, 
                                                 pvalue_thresh=0.05)))

panelFn2 <- panelFunctionGenerator("vanKrevelenPlot", colorCName="uniqueness_gtest")

# Note: uniquenessColName parameter tells vanKrevelenCognostics which column to use to determine
# group uniqueness for each peak. If only one summary function is used in summarizeGroupComparisons
# then it will be inferred, otherwise it's necessary to specify.
makeDisplay(grpCompSummaryDdo,
         panelFn=panelFn2,
         cogFn=vanKrevelenCognostics(uniquenessColName="uniqueness_gtest"),
         name = "Van_Krevelen_plots_for_group_comparison_summaries")

view()
}