Decorates LFQData with methods to aggregate protein intensities aggregates intensities

Decorates LFQData with methods to aggregate protein intensities aggregates intensities

Public fields

lfq

LFQData

lfq_agg

aggregation result

prefix

to use for aggregation results e.g. protein

Methods


Method new()

initialize

Usage

LFQDataAggregator$new(lfq, prefix = "protein")

Arguments

lfq

LFQData

prefix

default protein


Method medpolish()

aggregate using median polish

Usage

LFQDataAggregator$medpolish()

Arguments

N

top N by intensity

Returns

LFQData


Method lmrob()

aggregate using robust regression

Usage

LFQDataAggregator$lmrob()

Arguments

N

top N by intensity

Returns

LFQData


Method mean_topN()

aggregate topN using mean

Usage

LFQDataAggregator$mean_topN(N = 3)

Arguments

N

top N by intensity

Returns

LFQData


Method sum_topN()

aggregate topN using sum

Usage

LFQDataAggregator$sum_topN(N = 3)

Arguments

N

top N by intensity

Returns

LFQData


Method plot()

creates aggreation plots

Usage

LFQDataAggregator$plot(show.legend = FALSE)

Arguments

show.legend

default FALSE

Returns

data.frame


Method write_plots()

writes plots to folder

Usage

LFQDataAggregator$write_plots(
  qcpath,
  show.legend = FALSE,
  width = 6,
  height = 6
)

Arguments

qcpath

qcpath

show.legend

legend

width

figure width

height

figure height

Returns

file path


Method clone()

The objects of this class are cloneable with this method.

Usage

LFQDataAggregator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

istar <-  prolfqua::sim_lfq_data_peptide_config()
#> creating sampleName from fileName column
#> Warning: no nr_children column specified in the data, adding column nr_children and setting to 1.
#> completing cases
istar$config <- istar$config
data <- istar$data |> dplyr::filter(protein_Id %in% sample(protein_Id, 100))
lfqdata <- LFQData$new(data, istar$config)

lfqTrans <- lfqdata$clone()$get_Transformer()
lfqTrans$log2()
#> Column added : log2_abundance
lfqTrans <- lfqTrans$robscale()$lfq
#> data is : TRUE
#> Warning: Expected 2 pieces. Additional pieces discarded in 336 rows [1, 2, 3, 4, 5, 6,
#> 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
#> Joining with `by = join_by(sampleName, protein_Id, peptide_Id)`
lfqAggregator <- LFQDataAggregator$new(lfqTrans, "protein")

lfqAggregator$medpolish()
#> starting aggregation
pmed <- lfqAggregator$plot()
pmed$plots[[1]]
#> Warning: Removed 7 rows containing missing values or values outside the scale range
#> (`geom_point()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).

lfqAggregator$lmrob()
#> starting aggregation
prob <- lfqAggregator$plot()
prob$plots[[1]]
#> Warning: Removed 7 rows containing missing values or values outside the scale range
#> (`geom_point()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).


lfqCopy <- lfqdata$clone()
lfqCopy$is_transformed()
#> [1] FALSE
lfqAggregator <- LFQDataAggregator$new(lfqCopy, "protein")
lfqAggregator$sum_topN()
#> Joining with `by = join_by(protein_Id, peptide_Id)`
#> Columns added : srm_meanInt srm_meanIntRank
pSum <- lfqAggregator$plot()
pSum$plots[[1]]
#> Warning: Removed 7 rows containing missing values or values outside the scale range
#> (`geom_point()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).


lfqAggregator$mean_topN()
#> Joining with `by = join_by(protein_Id, peptide_Id)`
#> Columns added : srm_meanInt srm_meanIntRank
pMean <- lfqAggregator$plot()
pMean$plots[[1]]
#> Warning: Removed 7 rows containing missing values or values outside the scale range
#> (`geom_point()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).

protPlotter <- lfqAggregator$lfq_agg$get_Plotter()
protPlotter$heatmap()
if (FALSE) {
lfqAggregator$write_plots(tempdir())
}