Convert feature group data to a data.table (or data.frame).
Usage
# S4 method for class 'featureGroups'
as.data.table(
x,
average = FALSE,
areas = FALSE,
features = FALSE,
qualities = FALSE,
regression = FALSE,
regressionBy = NULL,
averageFunc = mean,
normalized = FALSE,
FCParams = NULL,
concAggrParams = getDefPredAggrParams(),
toxAggrParams = getDefPredAggrParams(),
normConcToTox = FALSE,
anaInfoCols = NULL,
IMS = "both"
)
# S4 method for class 'featureGroupsScreening'
as.data.table(x, ..., collapseSuspects = ",", onlyHits = FALSE)
# S4 method for class 'featureGroupsScreeningSet'
as.data.table(x, ..., collapseSuspects = ",", onlyHits = FALSE)Arguments
- x
The
featureGroupslike object to be exported as table.- average
Controls the averaging of feature intensities. Averaging also influences the calculation of regression parameters. Set to
FALSEto disable averaging,TRUEto average per replicate or to the name of a column in the analysis information to compare by a custom grouping of analyses.If
features=TRUEall numerical properties are averaged and non-numericals are collapsed. Each row represents the feature aggregated data and the groups used for aggregation (e.g. replicates) are stored in theaverage_groupcolumn. It is also possible to average these data per feature group, by settingaverage="fGroups".- areas
If set to
TRUEthen areas are output instead of peak intensities. Ignored iffeatures=TRUE, as areas of features are always reported.- features
If
TRUEthen feature specific data will be added. Also see theaverageargument.- qualities
Adds feature (group) qualities (
qualities="quality"), scores (qualities="score") or both (qualities="both"), if this data is available (i.e. fromcalculatePeakQualities). Ifqualities=FALSEthen nothing is reported.- regression, regressionBy
Used for regression calculations. See the
Regression calculationsection below. Set toNULLto ignore.- averageFunc
Function used for averaging. Only used when data is averaged or
FCParams != NULL.- normalized
If
TRUEthen normalized intensities are used (see theFeature intensity normalizationsection). If no normalization data is available (e.g. becausenormIntswas not used) then an automatic group normalization is performed.- FCParams
A parameter list to calculate fold change data. See
getFCParamsfor more details. Set toNULLto not perform FC calculations. NOTE: the intensity data is always averaged to calculate fold changes (usingaverageFunc) by replicates, irrespective of theaverageargument.- concAggrParams, toxAggrParams
Parameters to aggregate calculated concentrations/toxicities (obtained with
calculateConcs/calculateTox). See prediction aggregation parameters for more information. Set toNULLto omit this data.- normConcToTox
Set to
TRUEto normalize concentrations to toxicities. Only relevant if this data is present (seecalculateConcs/calculateTox).- anaInfoCols
A
characterwith any additional columns from the analysis information table. Only supported iffeatures=TRUE. If averaging is performed, then numeric data is averaged and character data collapsed. Set toNULLto ignore.- IMS
(IMS workflow) Specifies which feature groups are considered to be returned in IMS workflows. The following options are valid:
"both": Selects IMS and non-IMS features."maybe": Selects non-IMS features and IMS features without assigned IMS precursor.FALSE: Selects only non-IMS features.TRUE: Selects only IMS features.
- ...
Passed to the parent
as.data.tablemethod.- collapseSuspects
If a
characterthen any suspects that were matched to the same feature group are collapsed to a single row and suspect names are separated by the value ofcollapseSuspects. IfNULLthen no collapsing occurs, and each suspect match is reported on a single row. See theSuspect collapsingsection below for additional details.- onlyHits
If
TRUEthen only feature groups with suspect hits are reported.
Details
The as.data.table generic function converts most feature group data to a highly customizable
data.table. If a classical data.frame is preferred, the as.data.frame generic function
can be used instead and accepts the exact same arguments. The methods defined for suspect
screening workflows will merge the information from screenInfo, such as
suspect names and other properties and annotation data.
Regression calculation
The regression argument controls the calculation of regression parameters
from a regression model calculated with feature intensities (or areas if areas=TRUE). Here, simple linear
regression is used, i.e. y=ax+b with a the slope and b the intercept. The value for
regression should be the name of a column in the analysis information table
with numerical data to be used for x-values. Alternatively, if regression=TRUE then the "conc" column
is used. Any NA x-values are ignored, and no regression will be calculated if less than two (non-NA)
x-values are available. The output table will contain properties such as the slope and correlation coefficient
(R-squared). Furthermore, if features=TRUE then x-values will be calculated from the model and stored in the
x_reg column.
The regressionBy argument can be used to construct separate regression models for different groups of
analysis. It should be set to the name of a column in the analysis information table
which defines the grouping between samples. If features=TRUE then the grouping is stored in the
regression_group column of the output table.
Please see the handbook for examples on how to use the regression functionality.
Suspect collapsing
The as.data.table method for featureGroupsScreening supports an
additional format where each suspect hit is reported on a separate row (enabled by setting
collapseSuspects=NULL). In this format the suspect
properties from the screenInfo method are merged with each suspect row. Alternatively, if suspect
collapsing is enabled (the default) then the regular as.data.table format is used, and amended with the
names and estimated ID levels (if available) of the suspects matched to a feature group (each separated by the
value of the collapseSuspects argument).
Suspect collapsing also influences the reporting of predicted feature concentrations and
toxicities. In the case that (1) suspects are not collapsed in the output table and (2)
predictions are available for a specific suspect hit (i.e. if predictRespFactors or
predictTox was called on the feature groups object), then only the suspect specific data is reported
and no aggregation is performed. Hence, this allows you to obtain specific concentration/toxicity values for each
suspect/feature group pair.
IMS workflows
If the IMS argument is set to "both" or "maybe" then
"mobility_collapsed" and "CCS_collapsed" columns will be added that summarize all
mobility/CCS values of the IMS features (or IMS feature groups) assigned to this IMS precursor. These
numbers are currently rounded to 3 decimals.
Sets workflows
In a sets workflow normalization of feature intensities occur per set.
In sets workflows the analysis information contains an additional "set"
column, which can be used for arguments that involve grouping of analyses. For instance, if
regressionBy="set" then regression models will be calculated for each set.