@@ -411,14 +411,21 @@ setGeneric("chromPeakData<-", function(object, value)
411
411
# '
412
412
# ' Parameter `return.type` allows to specify the *type* of the result object.
413
413
# ' With `return.type = "Spectra"` (the default) a [Spectra] object with all
414
- # ' matching spectra is returned. The spectra variable `"peak_id"` of the
415
- # ' returned `Spectra` contains the ID of the chromatographic peak (i.e., the
416
- # ' rowname of the peak in the `chromPeaks` matrix) for each spectrum.
417
- # ' With `return.type = "Spectra"` a `List` of `Spectra` is returned. The
418
- # ' length of the list is equal to the number of rows of `chromPeaks`. Each
419
- # ' element of the list contains thus a `Spectra` with all spectra for one
420
- # ' chromatographic peak (or a `Spectra` of length 0 if no spectrum was found
421
- # ' for the respective chromatographic peak).
414
+ # ' matching spectra is returned. With `return.type = "Spectra"` a `List` of
415
+ # ' `Spectra` is returned. The length of the list is equal to the number of rows
416
+ # ' of `chromPeaks`. Each element of the list contains thus a `Spectra` with all
417
+ # ' spectra for one chromatographic peak (or a `Spectra` of length 0 if no
418
+ # ' spectrum was found for the respective chromatographic peak).
419
+ # '
420
+ # ' Parameters `addColumnsChromPeaks` allow the user to add specific metadata
421
+ # ' columns from the chromatographic peaks (`chromPeaks`) to the returned
422
+ # ' spectra object. This can be useful to retain information such as retention
423
+ # ' time (`rt`), m/z (`mz`). The columns will be named as they is written in the
424
+ # ' `chromPeaks` object with a prefix that is defined by the parameter
425
+ # ' `addColumnsChromPeaksPrefix`. The *peak ID* (i.e., the row name of the
426
+ # ' peak in the `chromPeaks` matrix) is always added to the spectra object as
427
+ # ' metadata column `paste0(addColumnsChromPeaksPrefix,id)`, by default it will
428
+ # ' be `"chrom_peak_id"`.
422
429
# '
423
430
# ' See also the *LC-MS/MS data analysis* vignette for more details and examples.
424
431
# '
@@ -453,6 +460,16 @@ setGeneric("chromPeakData<-", function(object, value)
453
460
# ' @param return.type `character(1)` defining the type of result object that
454
461
# ' should be returned.
455
462
# '
463
+ # ' @param addColumnsChromPeaks `character` vector with the names of the columns
464
+ # ' from `chromPeaks` that should be added to the returned spectra object.
465
+ # ' The columns will be named as they are written in the `chromPeaks` object
466
+ # ' with a prefix that is defined by the parameter
467
+ # ' `addColumnsChromPeaksPrefix`. Defaults to `c("mz", "rt")`.
468
+ # '
469
+ # ' @param addColumnsChromPeaksPrefix `character(1)` defining the prefix that
470
+ # ' should be used for the columns from `chromPeaks` that are added to the
471
+ # ' returned spectra object. Defaults to `"chrom_peak_"`.
472
+ # '
456
473
# ' @param BPPARAM parallel processing setup. Defaults to [bpparam()].
457
474
# '
458
475
# ' @param ... ignored.
@@ -503,7 +520,7 @@ setGeneric("chromPeakData<-", function(object, value)
503
520
# ' ## spectra variable *peak_id* contain the row names of the peaks in the
504
521
# ' ## chromPeak matrix and allow thus to map chromatographic peaks to the
505
522
# ' ## returned MS2 spectra
506
- # ' ms2_sps$peak_id
523
+ # ' ms2_sps$chrom_peak_id
507
524
# ' chromPeaks(dda)
508
525
# '
509
526
# ' ## Alternatively, return the result as a List of Spectra objects. This list
@@ -799,10 +816,24 @@ setGeneric("featureDefinitions<-", function(object, value)
799
816
# ' spectrum **per chromatographic peak** will be returned (hence multiple
800
817
# ' spectra per feature).
801
818
# '
802
- # ' The ID of each chromatographic peak (i.e. its row name in `chromPeaks`)
803
- # ' and each feature (i.e., its row name in `featureDefinitions`) are
804
- # ' available in the returned [Spectra()] with spectra variables `"peak_id"`
805
- # ' and `"feature_id"`, respectively.
819
+ # ' The information from `featureDefinitions` for each feature can be included
820
+ # ' in the returned [Spectra()] object using the `addColumnsFeatures` parameter.
821
+ # ' This is useful for retaining details such as the median retention time (`rtmed`)
822
+ # ' or median m/z (`mzmed`). The columns will retain their names as specified
823
+ # ' in the `featureDefinitions` object, prefixed by the value of the
824
+ # ' `addColumnsFeaturesPrefix` parameter. Additionally, the *feature ID*
825
+ # ' (i.e., the row name of the feature in the `featureDefinitions` data.frame)
826
+ # ' is always added as a metadata column with the name
827
+ # ' `paste0(addColumnsFeaturesPrefix, "id")`, which defaults to `"feature_id"`.
828
+ # '
829
+ # ' See also [chromPeakSpectra()], as it supports a similar parameter for
830
+ # ' including columns from the chromatographic peaks in the returned spectra object.
831
+ # ' These parameters can be used in combination to include information from both
832
+ # ' the chromatographic peaks and the features in the returned [Spectra()].
833
+ # ' The *peak ID* (i.e., the row name of the peak in the `chromPeaks` matrix)
834
+ # ' is added as a metadata column with the name
835
+ # ' `paste0(addColumnsChromPeaksPrefix, "id")`, which defaults to
836
+ # ' `"chrom_peak_id"`.
806
837
# '
807
838
# ' @param object [XcmsExperiment] or [XCMSnExp] object with feature defitions.
808
839
# '
@@ -815,6 +846,16 @@ setGeneric("featureDefinitions<-", function(object, value)
815
846
# ' `featureDefinitions(x)`). This parameter overrides `skipFilled` and is
816
847
# ' only supported for `return.type` being either `"Spectra"` or `"List"`.
817
848
# '
849
+ # ' @param addColumnsFeatures `character` vector with the names of the columns
850
+ # ' from `featureDefinitions` that should be added to the returned spectra
851
+ # ' object. The columns will be named as they are written in the
852
+ # ' `featureDefinitions` object with a prefix that is defined by the parameter
853
+ # ' `addColumnsFeaturesPrefix`. Defaults to `c("mzmed", "rtmed")`.
854
+ # '
855
+ # ' @param addColumnsFeaturesPrefix `character(1)` defining the prefix that
856
+ # ' should be used for the columns from `featureDefinitions` that are added
857
+ # ' to the returned spectra object. Defaults to `"feature_"`.
858
+ # '
818
859
# ' @param ... additional arguments to be passed along to [chromPeakSpectra()],
819
860
# ' such as `method`.
820
861
# '
0 commit comments