data: a data frame containing at least peptide, precursor or protein identifiers, information on conditions and intensity values for each peptide, precursor or protein.
grouping: a character column in the data data frame that contains the grouping variables (e.g. peptides, precursors or proteins).
condition: a character or factor column in the data data frame that contains condition information (e.g. "treated" and "control").
intensity: a numeric column in the data data frame that contains the corresponding raw or untransformed normalised intensity values for each peptide or precursor.
plot: a logical value that indicates whether the result should be plotted.
plot_style: a character value that indicates the plotting style. plot_style = "boxplot"
plots a boxplot, whereas plot_style = "density" plots the CV density distribution. plot_style = "violin" returns a violin plot. Default is plot_style = "density".
max_cv: a numeric value that specifies the maximum percentage of CVs that should be included in the returned plot. The default value is max_cv = 200.
Returns
Either a data frame with the median CVs in % or a plot showing the distribution of the CVs is returned.
Examples
# Load librarieslibrary(dplyr)set.seed(123)# Makes example reproducible# Create example datadata <- create_synthetic_data( n_proteins =100, frac_change =0.05, n_replicates =3, n_conditions =2, method ="effect_random")%>% mutate(intensity_non_log2 =2^peptide_intensity_missing)# Calculate coefficients of variationqc_cvs( data = data, grouping = peptide, condition = condition, intensity = intensity_non_log2, plot =FALSE)# Plot coefficients of variation# Different plot styles are availableqc_cvs( data = data, grouping = peptide, condition = condition, intensity = intensity_non_log2, plot =TRUE, plot_style ="violin")