### Example Analysis with readDIANN Source: https://bioc.r-universe.dev/limpa/doc/manual.html This example demonstrates a typical workflow after reading DIA-NN data, including calculating precursor density and quantifying proteins. ```R ## Not run: typep <- readDIAN() dpcest <- dpc(ypep) yprot <- dpcQuant(ypep, dpc=dpcest) ## End(Not run) ``` ```R ## Not run: typep <- readDIAN() dpcest <- dpc(ypep) yprot <- dpcQuant(ypep, dpc=dpcest) ## End(Not run) ``` -------------------------------- ### Example: Plotting Protein Data Source: https://bioc.r-universe.dev/limpa/doc/manual.html This example demonstrates how to generate sample protein data, quantify it using `dpcQuant`, and then plot the results for a specific protein, including its standard error. ```R y.peptide <- simProteinDataSet() y.protein <- dpcQuant(y.peptide, "Protein", dpc=c(-4,0.7)) plotProtein(y.protein, protein = "Protein01", col = rep(c("blue", "red"), each = 5)) y.protein$other$standard.error["Protein01",] ``` ```R y.peptide <- simProteinDataSet() y.protein <- dpcQuant(y.peptide, "Protein", dpc=c(-4,0.7)) plotProtein(y.protein, protein = "Protein01", col = rep(c("blue", "red"), each = 5)) y.protein$other$standard.error["Protein01",] ``` -------------------------------- ### VoomaLmFitWithImputation Examples Source: https://bioc.r-universe.dev/limpa/doc/manual.html Examples demonstrating the use of voomaLmFitWithImputation with a precision predictor and for reproducing vooma plots. ```R # Example with a precision predictor group <- gl(2,4) design <- model.matrix(~group) y <- matrix(rnorm(500*8),500,8) u <- matrix(runif(length(y)),500,8) yu <- y*u fit <- voomaLmFitWithImputation(yu,design,plot=TRUE,predictor=u) # Reproducing vooma plot from output object fit <- voomaLmFitWithImputation(yu,design,predictor=u,save.plot=TRUE) do.call(plot,fit$voom.xy) do.call(lines,fit$voom.line) ``` ```R # Example with a precision predictor group <- gl(2,4) design <- model.matrix(~group) y <- matrix(rnorm(500*8),500,8) u <- matrix(runif(length(y)),500,8) yu <- y*u fit <- voomaLmFitWithImputation(yu,design,plot=TRUE,predictor=u) # Reproducing vooma plot from output object fit <- voomaLmFitWithImputation(yu,design,predictor=u,save.plot=TRUE) do.call(plot,fit$voom.xy) do.call(lines,fit$voom.line) ``` -------------------------------- ### Install 'limpa' R Package Source: https://bioc.r-universe.dev/limpa Use this command to install the 'limpa' package from the bioc-universe repository. Ensure you have the 'remotes' package installed if you encounter issues with custom repositories. ```r install.packages('limpa', repos = c('https://bioc.r-universe.dev', 'https://cloud.r-project.org')) ``` -------------------------------- ### Example Usage of estimateDPCIntercept Source: https://bioc.r-universe.dev/limpa/doc/manual.html This example demonstrates how to use the `estimateDPCIntercept` function. It first simulates a protein data set using `simProteinDataSet` and then calls `estimateDPCIntercept` with the simulated data and a specified DPC slope. ```R y <- simProteinDataSet(n.peptides=100, n.groups=1, dpc.slope=0.7) estimateDPCIntercept(y, dpc.slope=0.7) ``` ```R y <- simProteinDataSet(n.peptides=100, n.groups=1, dpc.slope=0.7) estimateDPCIntercept(y, dpc.slope=0.7) ``` -------------------------------- ### Downstream Analysis with readFragPipe Output Source: https://bioc.r-universe.dev/limpa/doc/manual.html Demonstrates using the output of `readFragPipe` for downstream analysis, including peptide-precursor quantification and protein-level quantification. This example is not run by default. ```R ## Not run: typep <- readFragPipe() dpcfit <- dpc(ypep) yprot <- dpcQuant(ypep, dpc=dpcfit) ## End(Not run) ``` ```R ## Not run: typep <- readFragPipe() dpcfit <- dpc(ypep) yprot <- dpcQuant(ypep, dpc=dpcfit) ## End(Not run) ``` -------------------------------- ### Example Usage of dpcQuant Source: https://bioc.r-universe.dev/limpa/doc/manual.html This example demonstrates how to use the dpcQuant function to quantify protein expression values from a simulated dataset. The function takes precursor intensities and protein IDs to produce quantified protein expression. ```R y.peptide <- simProteinDataSet(n.groups=1,samples.per.group=4,prop.missing=0.2) y.protein <- dpcQuant(y.peptide, "Protein", dpc.slope=0.7) ``` ```R y.peptide <- simProteinDataSet(n.groups=1,samples.per.group=4,prop.missing=0.2) y.protein <- dpcQuant(y.peptide, "Protein", dpc.slope=0.7) ``` -------------------------------- ### Quick Start: limpa Analysis Workflow Source: https://bioc.r-universe.dev/limpa/doc/limpa.Rmd Demonstrates a basic workflow for analyzing proteomics data using limpa, including precursor quantification and differential expression analysis. ```r library(limpa) dpcest <- dpc(y.prec) y.protein <- dpcQuant(y.prec, protein.id, dpc=dpcest) fit <- dpcDE(y.protein, design) fit <- eBayes(fit) topTable(fit) ``` -------------------------------- ### Example Usage of readMaxQuant Source: https://bioc.r-universe.dev/limpa/doc/manual.html Demonstrates how to use the `readMaxQuant` function to read data and then apply the `dpc` function. This is a typical workflow for processing MaxQuant output. ```R y <- readMaxQuant("peptides.txt") dpcfit <- dpc(y) ``` ```R y <- readMaxQuant("peptides.txt") dpcfit <- dpc(y) ``` -------------------------------- ### Example Usage of simProteinDataSet Source: https://bioc.r-universe.dev/limpa/doc/manual.html Demonstrates basic simulation of peptide data with one group. The output is an EList object containing simulated log2-expression values. ```R y <- simProteinDataSet(n.peptides=10, n.groups=1) show(y) ``` ```R y <- simProteinDataSet(n.peptides=10, n.groups=1) show(y) ``` -------------------------------- ### Simulate Data and Estimate DPC using dpcON Source: https://bioc.r-universe.dev/limpa/doc/manual.html Example demonstrating how to simulate a protein data set and then estimate the detection probability curve using the dpcON function. The estimated DPC coefficients are then accessed. ```R y <- simProteinDataSet(n.peptides=100, n.groups=1) dpcest <- dpcON(y) dpcest$dpc ``` ```R y <- simProteinDataSet(n.peptides=100, n.groups=1) dpcest <- dpcON(y) dpcest$dpc ``` -------------------------------- ### voomaLmFitWithImputation Function Usage Source: https://bioc.r-universe.dev/limpa/doc/manual.html Demonstrates the usage of the voomaLmFitWithImputation function with its various arguments. This function is equivalent to calling vooma(), arrayWeights(), duplicateCorrelation(), and lmFit() iteratively. ```R voomaLmFitWithImputation(y, design = NULL, prior.weights = NULL, imputed = NULL, block = NULL, sample.weights = FALSE, var.design = NULL, var.group = NULL, prior.n = 10, predictor = NULL, span = NULL, legacy.span = FALSE, plot = FALSE, save.plot = FALSE, keep.EList = TRUE) voomaLmFitWithImputation(y, design = NULL, prior.weights = NULL, imputed = NULL, block = NULL, sample.weights = FALSE, var.design = NULL, var.group = NULL, prior.n = 10, predictor = NULL, span = NULL, legacy.span = FALSE, plot = FALSE, save.plot = FALSE, keep.EList = TRUE) ``` -------------------------------- ### Zero-Truncated Binomial Distribution Usage Source: https://bioc.r-universe.dev/limpa/doc/manual.html Demonstrates the density and distribution functions for the zero-truncated binomial distribution, comparing them to the standard binomial distribution. ```R # Compare to binomial x <- 1:3 dztbinom(x, size=3, prob=0.5) dbinom(x, size=3, prob=0.5) pztbinom(x, size=3, prob=0.5) pbinom(x, size=3, prob=0.5) ``` ```R # Compare to binomial x <- 1:3 dztbinom(x, size=3, prob=0.5) dbinom(x, size=3, prob=0.5) pztbinom(x, size=3, prob=0.5) pbinom(x, size=3, prob=0.5) ``` -------------------------------- ### voomaLmFitWithImputation Source: https://bioc.r-universe.dev/limpa/doc/manual.html Applies a vooma-lmFit pipeline with automatic estimation of sample weights and block correlation. This function estimates the variance trend, uses it to compute observational weights, and then fits a linear model. It handles automatic estimation of sample weights and block correlation, and is equivalent to calling vooma(), arrayWeights(), duplicateCorrelation(), and lmFit() iteratively. ```APIDOC ## voomaLmFitWithImputation ### Description Estimate the variance trend, use it to compute observational weights and use the weights to a fit a linear model. Includes automatic estimation of sample weights and block correlation. Equivalent to calling vooma(), arrayWeights(), duplicateCorrelation() and lmFit() iteratively. ### Usage ```R voomaLmFitWithImputation(y, design = NULL, prior.weights = NULL, imputed = NULL, block = NULL, sample.weights = FALSE, var.design = NULL, var.group = NULL, prior.n = 10, predictor = NULL, span = NULL, legacy.span = FALSE, plot = FALSE, save.plot = FALSE, keep.EList = TRUE) ``` ### Arguments `y` | a numeric `matrix`, `EList` object, or any object containing log-expression data that can be coerced to a matrix. Rows correspond to genes and columns to samples. `design` | design matrix with rows corresponding to samples and columns to coefficients to be estimated. Defaults to the unit vector meaning that samples are treated as replicates. `prior.weights` | prior weights. Can be a numeric matrix of individual weights of same dimensions as the `counts`, or a numeric vector of sample weights with length equal to `ncol(counts)`, or a numeric vector of gene weights with length equal to `nrow(counts)`. `imputed` | logical matrix of the same size as `y` indicating whether each observation was entirely imputed. `block` | vector or factor specifying a blocking variable on the arrays. Has length equal to `ncol(y)`. `sample.weights` | logical value. If `TRUE` then empirical sample quality weights will be estimated. `var.design` | design matrix for predicting the sample variances. Defaults to the sample-specific model whereby each sample has a different variance. `var.group` | vector or factor indicating groups to have different sample weights. This is another way to specify `var.design` for groupwise sample weights. `prior.n` | prior number of genes for squeezing the weights towards equality. Larger values squeeze the sample weights more strongly towards equality. `predictor` | precision predictor. Either a column vector of length `nrow(y)` or a numeric matrix of the same dimensions as `y` that predicts the precision of each log-expression value. Is used as a second covariate together with the log-intensities to predict the variances and produce the final precision weights. `span` | width of the smoothing window, as a proportion of the data set. Defaults to a value between 0.3 and 1 that depends the number of genes (`nrow(y)`). Equal to 1 if the number of genes is less than or equal to 50, then decreases slowly to 0.3 if the number of genes is very large. `legacy.span` | logical. If `TRUE`, then the original default setting will be used for `span`, which is slightly smaller than the new default. `plot` | logical. If `TRUE`, a plot of the mean-variance trend is displayed. `save.plot` | logical, should the coordinates and line of the plot be saved in the output? `keep.EList` | logical. If `TRUE`, then the `EList` object containing log-expression values and observation weights will be saved in the component `EList` of the output object. ``` -------------------------------- ### Convert Peptides to Protein Expression (Newton's Method) Source: https://bioc.r-universe.dev/limpa/doc/manual.html Maximizes the posterior for protein expression using Newton's method. Suitable for iterative optimization with specified tolerance and maximum iterations. Handles NA values in the input matrix. ```R peptides2ProteinNewton(y, sigma = 0.5, weights = NULL, dpc = c(-4, 0.7), prior.mean = 6, prior.sd = 10, prior.logFC = 2, standard.errors = TRUE, tol=1e-6, maxit=10, start = NULL, verbose = FALSE) ``` -------------------------------- ### Simulate Data from Observed Normal Model Source: https://bioc.r-universe.dev/limpa/doc/manual.html Simulate data using `simCompleteDataON` for the observed normal model. This function generates complete values and indicates which are observed and missing, along with their missing probabilities. Useful for exploring the ON model where observed values are exactly normal. ```r out <- simCompleteDataON(100, mean.obs=6, sd.obs=1) mean(out$prob.missing) qqnorm(out$y.complete) qqline(out$y.complete) ``` ```r out <- simCompleteDataON(100, mean.obs=6, sd.obs=1) mean(out$prob.missing) qqnorm(out$y.complete) qqline(out$y.complete) ``` -------------------------------- ### Impute Missing Values by Exponential Tilting Source: https://bioc.r-universe.dev/limpa/doc/manual.html Demonstrates the basic usage of the imputeByExpTilt function with a sample matrix containing a missing value. The function imputes missing values by default using both row and column tilting. ```R y <- matrix(rnorm(25),5,5) y[1,1] <- NA imputeByExpTilt(y) ``` -------------------------------- ### Quantify Proteins using DPC-Quant Source: https://bioc.r-universe.dev/limpa/doc/manual.html This snippet demonstrates how to use the `peptides2Proteins` function to quantify protein expression values. It requires a numeric matrix of log-intensity values and corresponding protein IDs. ```R peptides2Proteins(y, protein.id, sigma = 0.5, dpc = c(-4, 0.7), prior.mean = 6, prior.sd = 10, prior.logFC = 2, standard.errors = FALSE, newton.polish = FALSE, verbose = FALSE, chunk = 1000L) ``` ```R y.peptide <- simProteinDataSet(8,n.groups=1,samples.per.group=4,prop.missing=0.2) y.protein <- peptides2Proteins(y.peptide$E, y.peptide$genes$Protein) ``` ```R y.peptide <- simProteinDataSet(8,n.groups=1,samples.per.group=4,prop.missing=0.2) y.protein <- peptides2Proteins(y.peptide$E, y.peptide$genes$Protein) ``` -------------------------------- ### Create EList From Long Format File Source: https://bioc.r-universe.dev/limpa/doc/manual.html Use this function to create an EList object from a long format report file. It supports various quantification tools and file formats. Ensure correct column names for runs, features, and intensities are provided. ```R EListFromLongFormatFile( file = "report.tsv", path = NULL, format = NULL, sep = "\t", run.column, feature.column, intensity.column, annotation.columns = NULL, q.columns = NULL, q.cutoffs = 0.01, filter.columns = NULL, filter.values = TRUE, censor.value = NULL, matrix.columns = NULL, log = TRUE, verbose = TRUE) EListFromLongFormatFile( file = "report.tsv", path = NULL, format = NULL, sep = "\t", run.column, feature.column, intensity.column, annotation.columns = NULL, q.columns = NULL, q.cutoffs = 0.01, filter.columns = NULL, filter.values = TRUE, censor.value = NULL, matrix.columns = NULL, log = TRUE, verbose = TRUE) ``` -------------------------------- ### Simulate Proteomics Data Source: https://bioc.r-universe.dev/limpa/doc/limpa.Rmd Generates a simulated proteomics dataset for demonstration purposes. This function is useful for testing and understanding the package's functionality. ```r library(limpa) set.seed(20241230) y.prec <- simProteinDataSet() ``` -------------------------------- ### readSpectronaut Source: https://bioc.r-universe.dev/limpa/doc/manual.html Reads a Spectronaut Normal Report file into an EList or EListRaw object. It allows for detailed customization of column mapping, filtering, and intensity transformations. ```APIDOC ## readSpectronaut ### Description Read a Spectronaut Normal Report file into an EList or EListRaw object. ### Arguments `file` | name of the Normal Report file from which the data are to be read. Alternatively, `file` can be a data.frame, as would arise from reading the report file into R using a function such as `read.delim`. `path` | character string giving the directory containing the file. Defaults to the current working directory. `sep` | the field separator character. Spectronaut normally writes tab-delimited files, but this argument can be used to read comma-separated files if necessary. `run.column` | name of the column identifying the mass spectrometry runs. Usually each run is a distinct protein sample or, if fractioning is used, a fraction of a sample. `feature.column` | name of the column containing feature IDs, or a character vector containing the names of columns, which, when pasted together, will uniquely identify each feature. By default, the features are precursor ions, but other possibilities are fragments, peptides or proteins. See details for examples. This argument and `intensity.column` must correspond to the same feature level. `intensity.column` | name of column containing the feature intensities. By default, the precursor ion intensities are read, but see details for other possibilities. This argument and `feature.column` must correspond to the same feature level. `annotation.columns` | names of other columns to be read and included in the output `genes` data.frame annotating the precursors and proteins. `q.columns` | names of columns containing q-values for peptide or protein identification. `q.cutoffs` | cutoffs to apply to the q-value columns. Either a single value or a numeric vector of the same length as `q.columns`. If any q-value is above the corresponding cutoff, then the intensity will be set to `NA`. `filter.columns` | optional columns that will be used to filter observations. The columns may indicated observations that were imputed, or values not used for the final intensity estimates at the peptide or protein levels. `filter.values` | values for the `filter.columns` indicating that the observation should be filtered. `censor.value` | intensities less than or equal to this value will be replaced by NAs. Spectronaut uses precursor intensities of 0 as placeholders to indicate indetermined intensities. `run.info` | should run information columns be read? If `TRUE`, the run columns on condition and replicate will be read and stored in the `targets` data.frame. `log` | logical. If `TRUE` then intensities will be returned on the log2 scale, otherwise unlogged. `verbose` | logical, whether to send informative progress messages. Set this to `FALSE` if you want the function to run quietly. `...` | other arguments are not currently used. ``` -------------------------------- ### Read Spectronaut Data Source: https://bioc.r-universe.dev/limpa/doc/manual.html Reads a Spectronaut report file into an EList or EListRaw object. Use this for importing normalized intensity data from Spectronaut. ```r ## Not run: y <- readSpectronaut() dpcest <- dpc(y) ## End(Not run) ``` -------------------------------- ### Filter Singleton Peptides Source: https://bioc.r-universe.dev/limpa/doc/limpa.Rmd Optionally filters out proteins with only one detected precursor. This step is not required and keeping all proteins is generally recommended to retain maximum information. ```R y.prec <- filterSingletonPeptides(y.prec, min.n.peptides = 2) ``` -------------------------------- ### Read Spectronaut Normal Report Source: https://bioc.r-universe.dev/limpa/doc/manual.html Reads a Spectronaut Normal Report file into an EList or EListRaw object. Configure columns for features, intensity, annotations, and quality control. Optionally include run information and apply log transformation. ```R readSpectronaut( file = "Report.tsv", path = NULL, sep = "\t", run.column = "R.FileName", feature.column = c("EG.ModifiedSequence","FG.Charge"), intensity.column = "EG.TotalQuantity (Settings)", annotation.columns = c("PG.ProteinAccessions","PG.Genes"), q.columns = c("EG.Qvalue", "PG.Qvalue"), q.cutoffs = 0.01, filter.columns = "EG.IsImputed", filter.values = TRUE, censor.value = 0, run.info = TRUE, log = TRUE, verbose = TRUE, ... ) ``` ```R readSpectronautRunInfo( file="report.tsv", path=NULL, sep="\t", run.column = "R.FileName", run.info.columns = c("R.Condition","R.Fraction","R.Label","R.Replicate"), verbose = TRUE ) ``` ```R readSpectronaut( file = "Report.tsv", path = NULL, sep = "\t", run.column = "R.FileName", feature.column = c("EG.ModifiedSequence","FG.Charge"), intensity.column = "EG.TotalQuantity (Settings)", annotation.columns = c("PG.ProteinAccessions","PG.Genes"), q.columns = c("EG.Qvalue", "PG.Qvalue"), q.cutoffs = 0.01, filter.columns = "EG.IsImputed", filter.values = TRUE, censor.value = 0, run.info = TRUE, log = TRUE, verbose = TRUE, ... ) ``` ```R readSpectronautRunInfo( file="report.tsv", path=NULL, sep="\t", run.column = "R.FileName", run.info.columns = c("R.Condition","R.Fraction","R.Label","R.Replicate"), verbose = TRUE ) ``` -------------------------------- ### EListFromLongFormatFile Source: https://bioc.r-universe.dev/limpa/doc/manual.html Creates an EList object from a long format report file generated by mass spectrometry quantification tools like Spectronaut or DIA-NN. It allows for flexible parsing of various report formats and column specifications. ```APIDOC ## EListFromLongFormatFile ### Description Create an EList from a long format report file written by a quantification tool such as Spectronaut or DIA-NN. ### Usage ```R EListFromLongFormatFile( file = "report.tsv", path = NULL, format = NULL, sep = "\t", run.column, feature.column, intensity.column, annotation.columns = NULL, q.columns = NULL, q.cutoffs = 0.01, filter.columns = NULL, filter.values = TRUE, censor.value = NULL, matrix.columns = NULL, log = TRUE, verbose = TRUE) ``` ### Arguments `file` | the name or path of the report file. If a text file, it should not be compressed. Alternatively, `file` can be a long format data.frame, as would arise from reading the report file into R using a function such as `read.delim`. `path` | character string giving the directory containing the file. Defaults to the current working directory. `format` | character string giving the format of the file. Possible values are `"tsv"` for a tab-delimited text file or `"parquet"` for a Parquet format file. By default, the format is detected from the file name extension. `sep` | the field separator character for delimited text files. This argument is usually unnecessary, but it can be used in combination with `format="tsv"` to read comma-separated files. `run.column` | name of the column identifying the mass spectrometry runs. Usually each run is a distinct protein sample or, if fractioning is used, a fraction of a sample. `feature.column` | name of the column containing feature IDs, or a character vector containing the names of columns, which, when pasted together, will uniquely identify each feature. `intensity.column` | character string giving the name of the column containing feature intensities. `annotation.columns` | other columns to be read and included in the output `genes` data.frame annotating the features and proteins. `q.columns` | character vector of column names containing q-values for feature identification. `q.cutoffs` | cutoffs to apply to the q-values. Either a single value or a numeric vector of the same length as `q.columns`. Only features with all q-values below the corresponding cutoffs will be retained. `filter.columns` | optional columns that will be used to filter observations. The columns may indicated observations that were imputed, or values not used for the final intensity estimates. Any observation that is flagged by any of these columns will be `NA` in the output EList. `filter.values` | values for the `filter.columns` indicating that the observation should be filtered. `censor.value` | any intensities less than or equal to this value will be replaced by NAs. `matrix.columns` | character vector of column names containing observation-level covariates. Each such variable will be copied into a matrix of the same dimensions as the intensities and stored in the `other` component of the output object. `log` | logical. If `TRUE` then intensities will be returned on the log2 scale, otherwise unlogged. `verbose` | logical, whether to send informative progress messages. ### Details This function reads report files written in long format by tools wuch as DIA-NN (Demichev et al 2020), Spectronaut (https://biognosys.com/software/spectronaut/), or MSstats convert functions. It produces an EList or EListRaw object with features as rows and samples as columns. This function is most often used to read precursor ion intensities, but can read intensity data at any summarization level if the intensities are provided in the file. If `feature.column` contains protein IDs, then protein-level intensities (such as maxLFQ) summaries will be read. If `feature.column` specifies peptide sequence and charge, then precursor ion intensities will be read. If `feature.column` specifies fragment ion and fragment charge as well as peptide sequence and precursor charge, then fragment peak intensities can be read. If `file` is a Spectronaut v20 report file, then `feature.column="FG.ProteinsGroups"` and `intensity.column="PG.Quantity"` will read protein-level summary intensities, `feature.column=c("EG.ModifiedSquence,FG.Charge"` and `intensity.column="EG.TotalQuantity (Settings)"` will read precursor ion estimated intensities, while `feature.column=c("EG.ModifiedSequence","FG.Charge","F.FrgIon","F.Charge")` and `intensity.column="F.PeakArea"` will read fragment peak intensities. This function uses `data.table::fread` to read text files and `nanoparquet::read_parquet` to read Parquet files. ``` -------------------------------- ### Zero-Truncated Binomial Density Function Source: https://bioc.r-universe.dev/limpa/doc/manual.html Calculates the density for the zero-truncated binomial distribution. It functions similarly to R's dbinom but accounts for zero truncation. ```APIDOC ## dztbinom ### Description Density function for the zero-truncated binomial distribution. ### Usage dztbinom(x, size, prob, log = FALSE, logit.p = FALSE) ### Arguments - `x` (vector): Quantiles. - `size` (numeric): Number of trials (zero or more). - `prob` (numeric): Probability of success on each trial. - `log` (logical): If TRUE, the log-density is returned. - `logit.p` (logical): If TRUE, success probabilities `prob` are on the logit scale. ### Value Density values for the zero-truncated binomial distribution. ### Examples ```R x <- 1:3 dztbinom(x, size=3, prob=0.5) dbinom(x, size=3, prob=0.5) ``` ``` -------------------------------- ### Visualize Protein Expression with Standard Errors Source: https://bioc.r-universe.dev/limpa/doc/limpa.Rmd Visualizes protein expression data, accounting for standard errors generated by dpcQuant. Useful for observing sample clustering. ```r plotMDSUsingSEs(y.protein) Group <- factor(y.prec$targets$Group) Group.color <- Group levels(Group.color) <- c("blue","red") plotMDSUsingSEs(y.protein, pch=16, col=as.character(Group.color)) ``` -------------------------------- ### Citation BibTeX Entry 1 Source: https://bioc.r-universe.dev/limpa BibTeX entry for the paper 'Quantification and differential analysis of mass spectrometry proteomics data with probabilistic recovery of information from missing values'. ```bibtex @Article{ author = {Mengbo Li and Simon A Cobbold and Gordon K Smyth}, title = {Quantification and differential analysis of mass spectrometry proteomics data with probabilistic recovery of information from missing values}, journal = {bioRxiv}, year = {2025}, volume = {April 29}, pages = {651125}, doi = {10.1101/2025.04.28.651125}, } ``` -------------------------------- ### readSpectronautRunInfo Source: https://bioc.r-universe.dev/limpa/doc/manual.html Reads run information from a Spectronaut Normal Report file. This function is useful for extracting metadata about each run, such as experimental conditions and replicates. ```APIDOC ## readSpectronautRunInfo ### Description Read run information from a Spectronaut Normal Report file. ### Arguments `file` | name of the Normal Report file from which the data are to be read. Alternatively, `file` can be a data.frame, as would arise from reading the report file into R using a function such as `read.delim`. `path` | character string giving the directory containing the file. Defaults to the current working directory. `sep` | the field separator character. Spectronaut normally writes tab-delimited files, but this argument can be used to read comma-separated files if necessary. `run.column` | name of the column identifying the mass spectrometry runs. Usually each run is a distinct protein sample or, if fractioning is used, a fraction of a sample. `run.info.columns` | names of columns containing run-level information, for example information on the experimental conditions. By default, the standard Spectronaut columns are read. `verbose` | logical, whether to send informative progress messages. Set this to `FALSE` if you want the function to run quietly. ``` -------------------------------- ### Simulate Peptide Data Source: https://bioc.r-universe.dev/limpa/doc/manual.html Simulates peptide-level log2-expression values from a mass spectrometry experiment. This function is useful for generating realistic datasets for testing downstream analysis pipelines. ```R simProteinDataSet(n.peptides = 100, n.groups = 2, samples.per.group = 5, peptides.per.protein = 4, mu.range = c(2,10), sigma = 0.4, prop.de = 0.2, fc = 2, dpc.intercept = NULL, dpc.slope = 0.7, prop.missing = 0.4) ``` ```R simProteinDataSet(n.peptides = 100, n.groups = 2, samples.per.group = 5, peptides.per.protein = 4, mu.range = c(2,10), sigma = 0.4, prop.de = 0.2, fc = 2, dpc.intercept = NULL, dpc.slope = 0.7, prop.missing = 0.4) ``` -------------------------------- ### Zero-Truncated Binomial Distribution Function Source: https://bioc.r-universe.dev/limpa/doc/manual.html Calculates the cumulative distribution function for the zero-truncated binomial distribution. It mirrors R's pbinom but includes zero truncation. ```APIDOC ## pztbinom ### Description Distribution function for the zero-truncated binomial distribution. ### Usage pztbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE) ### Arguments - `q` (vector): Quantiles. - `size` (numeric): Number of trials (zero or more). - `prob` (numeric): Probability of success on each trial. - `lower.tail` (logical): If TRUE, probabilities are P(Xq). - `log.p` (logical): If TRUE, tail probabilities are on the log-scale. ### Value Cumulative probability values for the zero-truncated binomial distribution. ### Examples ```R x <- 1:3 pztbinom(x, size=3, prob=0.5) pbinom(x, size=3, prob=0.5) ``` ``` -------------------------------- ### Read MaxQuant Peptide Intensities Source: https://bioc.r-universe.dev/limpa/doc/manual.html Reads MaxQuant peptide output into an EList object. Use this function to import intensity data for peptide precursors from MaxQuant. ```R readMaxQuant( file = "peptides.txt", path = NULL, sep = "\t", log = TRUE, peptide.column = "Sequence", qty.column = NULL, qty.column.key = "Intensity ", q.columns = c("PEP"), q.cutoffs = 0.01, extra.columns = c("Proteins", "Leading razor protein", "Gene names", "Unique (Groups)", "Protein group IDs") ) ``` ```R readMaxQuant( file = "peptides.txt", path = NULL, sep = "\t", log = TRUE, peptide.column = "Sequence", qty.column = NULL, qty.column.key = "Intensity ", q.columns = c("PEP"), q.cutoffs = 0.01, extra.columns = c("Proteins", "Leading razor protein", "Gene names", "Unique (Groups)", "Protein group IDs") ) ``` -------------------------------- ### Read DIA-NN with Q-value Filtering (No MBR) Source: https://bioc.r-universe.dev/limpa/doc/limpa.Rmd Reads a DIA-NN 'Report.tsv' file and filters intensities based on specified Q-value columns and cutoffs, recommended for data searched without MBR. ```R y.prec <- readDIANN("Report.tsv", q.columns = c("Q.Value","Global.Q.Value","Global.PG.Q.Value"), q.cutoffs = 0.01) ``` -------------------------------- ### Convert Peptides to Protein Expression (BFGS) Source: https://bioc.r-universe.dev/limpa/doc/manual.html Uses the BFGS algorithm to maximize the posterior for protein expression. Standard errors are computed from analytic second derivatives. Handles NA values in the input matrix. ```R peptides2ProteinBFGS(y, sigma = 0.5, weights = NULL, dpc = c(-4, 0.7), prior.mean = 6, prior.sd = 10, prior.logFC = 2, standard.errors = TRUE, newton.polish = TRUE, start = NULL) ``` ```R y <- matrix(rnorm(12),3,4) y[1:2,1] <- NA y[1,2] <- NA peptides2ProteinBFGS(y) ``` ```R y <- matrix(rnorm(12),3,4) y[1:2,1] <- NA y[1,2] <- NA peptides2ProteinBFGS(y) ``` -------------------------------- ### Legacy Detection Probability Curve Estimation Source: https://bioc.r-universe.dev/limpa/doc/manual.html Use dpcLegacy for the original DPC estimation method. This function is essentially deprecated in favor of dpcON. ```R dpcLegacy(y, maxit = 100, eps = 1e-04, b1.upper = 1) ``` -------------------------------- ### simProteinDataSet Source: https://bioc.r-universe.dev/limpa/doc/manual.html Simulates peptide-level log2-expression values from a mass spectrometry experiment using a complete normal model. It allows for the simulation of differentially expressed proteins and missing values. ```APIDOC ## simProteinDataSet ### Description Simulate peptide-level log2-expression values from a mass spectrometry experiment. ### Usage ```R simProteinDataSet(n.peptides = 100, n.groups = 2, samples.per.group = 5, peptides.per.protein = 4, mu.range = c(2,10), sigma = 0.4, prop.de = 0.2, fc = 2, dpc.intercept = NULL, dpc.slope = 0.7, prop.missing = 0.4) ``` ### Arguments `n.peptides` (integer) - number of peptides (rows of output). `n.groups` (integer) - number of experimental groups (conditions). `samples.per.group` (integer) - number of samples per group. `peptides.per.protein` (integer) - number of peptides per protein. `mu.range` (numeric vector) - range of log2-expression values, in terms of expected value per peptide. `sigma` (numeric) - standard deviation of log2-expression values for each peptide in each group. `prop.de` (numeric) - proportion of differentially expressed proteins. `fc` (numeric) - true fold-change for differentially expressed proteins. `dpc.intercept` (numeric or NULL) - intercept of detection probability curve. Usually determined from `dpc.slope` and `prop.missing`. `dpc.slope` (numeric) - slope of detection probability curve. `prop.missing` (numeric) - proportion of missing values (at average log2-expression). Ignored if `dpc.intercept` is not `NULL`. ### Details Simulate peptide-level log2-expression values (log2-intensities) from a mass spectrometry experiment. Values are generated and missing values assigned according to the complete normal model. Each group of successive peptides is assumed to belong to one protein. If the protein is differentially expressed (DE), then each peptide belonging to that protein is also DE with the same fold-change. If `dpc.intercept` is not specified, then it is chosen to ensure that the proportion of missing values is equal to `prop.missing` at the average log2-expression value. The simulated data is stored in an EList object, the standard limma package data class for log-expression values. Peptides are ordered by average expected expression level. Some of the more lowly expressed peptides may be entirely NA, depending on the argument settings. ### Value EList containing simulated log2-expression values with `n.peptides` rows and `n.groups * n.samples.per.group` columns. The EList contains the following components: `E` (matrix) - matrix of peptide log2-expression values with NAs. `other$E.complete` (matrix) - matrix of complete log2-expression values without NAs. `genes` (data.frame) - data.frame with columns `Protein` and `DE.Status` giving protein ID and true DE status. `targets` (data.frame) - data.frame with column `Group` giving group identity for each sample. ### Examples ```R y <- simProteinDataSet(n.peptides=10, n.groups=1) show(y) ``` ``` -------------------------------- ### expTiltByColumns Source: https://bioc.r-universe.dev/limpa/doc/manual.html Applies exponential tilting imputation specifically to the columns of a numeric matrix. ```APIDOC ## expTiltByColumns ### Description Impute missing values in a numeric matrix by applying exponential tilting to columns. ### Usage ```R expTiltByColumns(y, dpc.slope = 0.7) ``` ### Arguments - **y** (numeric matrix) - A numeric matrix of log-expression values. Columns are samples and rows are peptides or proteins. - **dpc.slope** (numeric) - Slope of detection probability curve. Defaults to 0.7. ### Value A numeric matrix with NAs imputed. ### Examples ```R y <- matrix(rnorm(25),5,5) y[1,1] <- NA expTiltByColumns(y) ``` ``` -------------------------------- ### Read DIA-NN with Q-value Filtering (MBR) Source: https://bioc.r-universe.dev/limpa/doc/limpa.Rmd Reads a DIA-NN 'Report.tsv' file and filters intensities based on specified Q-value columns and cutoffs, recommended for data searched with match-between-run (MBR). ```R y.prec <- readDIANN("Report.tsv", q.columns = c("Q.Value","Lib.Q.Value","Lib.PG.Q.Value"), q.cutoffs = 0.01) ``` -------------------------------- ### peptides2ProteinNewton Source: https://bioc.r-universe.dev/limpa/doc/manual.html Maximizes the posterior using Newton's method. Computes standard errors from analytic second derivatives. ```APIDOC ## peptides2ProteinNewton ### Description Convert a matrix of peptide log-expression values for one protein to protein-level expression values by the DPC-Quant method using Newton's method. ### Method Newton's method optimization. ### Parameters - **y** (numeric matrix) - A matrix of log-expression values. Columns are samples and rows are peptides or precursors. Typically contains NAs. - **sigma** (numeric) - Standard deviation of peptide-level expression values after allowing for peptide and sample baseline differences. Default is 0.5. - **weights** (numeric matrix, optional) - A matrix of the same size as `y` containing positive precision weights. The precision of the log-expression values is summarized by `sigma/sqrt(weights)`. - **dpc** (numeric vector) - Intercept and slope of the detection probability curve (DPC). Default is c(-4, 0.7). - **prior.mean** (numeric) - Mean of the global prior distribution for protein log-expression values. Default is 6. - **prior.sd** (numeric) - Standard deviation of the global prior distribution for protein log-expression values. Default is 10. - **prior.logFC** (numeric) - Standard deviation to be expected between log-expression values for the same protein. Default is 2. - **standard.errors** (logical) - Should standard errors for the protein expression values be returned? Default is TRUE. - **tol** (numeric) - Stopping criterion tolerance for Newton's method. Default is 1e-6. - **maxit** (integer) - Maximum number of iterations for Newton's method. Default is 10. - **start** (numeric vector, optional) - Starting values for the linear model coefficients. Of length `ncol(y)+nrow(y)-1)`. - **verbose** (logical) - If TRUE, progress will be output at each iteration. Default is FALSE. ### Value A list with components: - **protein.expression** (numeric vector) - Estimated protein log-expression value for each sample. - **standard.error** (numeric vector) - Standard errors for the protein log-expression values. - **value** - The minimized objective function, minus twice the log-posterior distribution. ```