| Title: | Bipartite peptide-protein graphs |
|---|---|
| Description: | This package contains functionality to create and characterize bipartite graphs that model the relationship between peptides and proteins in bottom-up proteomics. With these graphs, protein ratios (fold change between two sample groups) are calculated from the respective measured peptide ratios. The main aim is to make use of quantitative information contained in shared peptides and making it possible to quantify proteins without shared peptides. Further, the package offers general analysis of peptide and protein relationships using bipartite graphs and visualization for these graphs. |
| Authors: | Karin Schork [aut, cre] (ORCID: <https://orcid.org/0000-0003-3756-4347>), Julika Wenzel [aut] (ORCID: <https://orcid.org/0009-0004-1468-5984>), Katharina Neuhaus [aut], Martin Eisenacher [aut, fnd] (ORCID: <https://orcid.org/0000-0003-2687-7444>) |
| Maintainer: | Karin Schork <[email protected]> |
| License: | BSD_3_clause + file LICENSE |
| Version: | 0.99.1 |
| Built: | 2026-10-11 10:05:26 UTC |
| Source: | https://github.com/BiocStaging/bppg |
Adds vertex attributes with uniqueness of peptides and number of unique peptides for proteins.
.addUniquenessAttributes(G).addUniquenessAttributes(G)
G |
igraph graph |
A graph with 2 additional vertex attributes, uniqueness and nr_unique_peptides
generateGraphsFromFASTA(), generateQuantGraphs()
file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) res <- bppg:::.addUniquenessAttributes(graphs[[1]][[2]]) # get uniqueness of all nodes (NA means it is a protein node, not a peptide) igraph::V(res)$uniqueness # get number of unique and shared peptides per protein node: igraph::V(res)$nr_unique_peptides igraph::V(res)$nr_shared_peptidesfile <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) res <- bppg:::.addUniquenessAttributes(graphs[[1]][[2]]) # get uniqueness of all nodes (NA means it is a protein node, not a peptide) igraph::V(res)$uniqueness # get number of unique and shared peptides per protein node: igraph::V(res)$nr_unique_peptides igraph::V(res)$nr_shared_peptides
Analyse results for a single protein
.analyseResultSingleProt( protNr, resProt, error_tol = 1e-10, ratioLog_tol = 1e-06 ).analyseResultSingleProt( protNr, resProt, error_tol = 1e-10, ratioLog_tol = 1e-06 )
protNr |
integer(1) |
resProt |
data.frame |
error_tol |
numeric(1) |
ratioLog_tol |
numeric(1) |
Vector with minimal error, estimate for Ri (single value or min/max), estimate for Ci (single value or min/max).
Calculate equality and inequality constraints for the optimization step
.calcConstraints(fixedCi, m).calcConstraints(fixedCi, m)
fixedCi |
numeric vector |
m |
integer(1) |
x is a vector containing first the RiLog values and then the Ci values (length 2*m if no Ci are fixed).
For the equality constraint (eqfun with corresponding bound eqB), the difference of the sum of the Ci values and 1 is calculated. The bound is set to 0, i.e. forcing the sum of the Ci to be 1. In case of fixed Ci values, the sum of the fixed and the free Ci values is considered.
The lower bound (LB) for the RiLog values is set to -Inf (no constraint) and to 0 for the Ci.
list containing the following elements (see also
solnp):
eqfun |
function for calculating equality constraints |
eqB |
vector of equality bounds for the variables |
LB |
lower bound for the variables |
# without fixed Ci bppg:::.calcConstraints(fixedCi = NULL, m = 3) # with fixed Ci bppg:::.calcConstraints(fixedCi = c(NA, 0.8, NA), m = 3)# without fixed Ci bppg:::.calcConstraints(fixedCi = NULL, m = 3) # with fixed Ci bppg:::.calcConstraints(fixedCi = c(NA, 0.8, NA), m = 3)
Calculate objective function for the optimization step
.calcObjectiveFunction(fixedCi, M, rjLog).calcObjectiveFunction(fixedCi, M, rjLog)
fixedCi |
numeric vector |
M |
matrix |
rjLog |
numeric vector |
The objective function is the sum of squared error terms calculated in
.errorEquation.
x is a vector containing first the RiLog values and then the Ci values (length 2*m if no Ci are fixed). If there are fixed Ci and m2 non-fixed ones, x has the length m + m2.
objective function that will be minimized
M <- matrix(c(1, 1, 1, 0, 1, 1), ncol = 2, byrow = FALSE) rjLog <- log2(c(0.6, 1.2, 1.5)) fun <- bppg:::.calcObjectiveFunction(fixedCi = NULL, M = M, rjLog = rjLog)M <- matrix(c(1, 1, 1, 0, 1, 1), ncol = 2, byrow = FALSE) rjLog <- log2(c(0.6, 1.2, 1.5)) fun <- bppg:::.calcObjectiveFunction(fixedCi = NULL, M = M, rjLog = rjLog)
Calculate optimal solution for a single gridpoint
.calcResultGridpoint(j, gridpoint, cnames, G, n, verbose, ...).calcResultGridpoint(j, gridpoint, cnames, G, n, verbose, ...)
j |
integer(1) |
gridpoint |
numeric(1) |
cnames |
character |
G |
igraph object |
n |
integer(1) |
verbose |
logical |
... |
additional arguments for |
Vector with the following elements:
protein |
index of protein (j) |
grid |
gridpoint |
res_Ri_Ci |
multiple values: estimated RiLog and Ci values |
error |
error term |
Cleavage of a single protein sequence.
.cleave(sequence, start, stop, miss).cleave(sequence, start, stop, miss)
sequence |
character |
start |
integer vector |
stop |
integer vector |
miss |
integer |
A dataframe with information (inkl. peptide sequence and start value) of the peptides.
Contracting of peptide and protein nodes.
.contractGraph(G, vMapping, collProtNodes, collPeptNodes).contractGraph(G, vMapping, collProtNodes, collPeptNodes)
G |
igraph graph |
vMapping |
list |
collProtNodes |
logical |
collPeptNodes |
logical |
An edgelist with collapsed protein and/or peptide nodes.
For graph collapsing: .getContractMapping() generateGraphsFromEdgelist()
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) vMapping <- bppg:::.getContractMapping(edgelist) G <- igraph::graph_from_edgelist(as.matrix(edgelist), directed = FALSE) igraph::V(G)[igraph::V(G)$name %in% edgelist[, 1]]$type <- TRUE igraph::V(G)[igraph::V(G)$name %in% edgelist[, 2]]$type <- FALSE res <- bppg:::.contractGraph(G, vMapping)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) vMapping <- bppg:::.getContractMapping(edgelist) G <- igraph::graph_from_edgelist(as.matrix(edgelist), directed = FALSE) igraph::V(G)[igraph::V(G)$name %in% edgelist[, 1]]$type <- TRUE igraph::V(G)[igraph::V(G)$name %in% edgelist[, 2]]$type <- FALSE res <- bppg:::.contractGraph(G, vMapping)
Digestion of a single protein sequence.
.digest2( sequence, enzyme = "trypsin", missed = 0, warn = TRUE, remove_initial_M = TRUE ).digest2( sequence, enzyme = "trypsin", missed = 0, warn = TRUE, remove_initial_M = TRUE )
sequence |
character |
enzyme |
character |
missed |
character |
warn |
logical |
remove_initial_M |
logical |
A vector of peptides.
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) # digest first protein sequence in the fasta file: digested_proteins <- bppg:::.digest2(fasta[[1]])library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) # digest first protein sequence in the fasta file: digested_proteins <- bppg:::.digest2(fasta[[1]])
Transform a bipartite graph into a directed graph.
.directBipartiteGraph(bip_graph, from_type = FALSE).directBipartiteGraph(bip_graph, from_type = FALSE)
bip_graph |
graph (igraph) |
from_type |
logical |
A bipartite graph that is know directed.
Function to set up the error equations for the optimization problem
.errorEquation(RiLog, Ci, M, rjLog).errorEquation(RiLog, Ci, M, rjLog)
RiLog |
numeric vector |
Ci |
numeric vector |
M |
matrix |
rjLog |
numeric vector |
list containing the following elements:
res_Mat |
matrix containing the estimated peptide ratios using the given Ri and Ci |
res_equ |
vector of error terms for each peptide |
res_squ_err |
sum of squared error terms |
W |
internal weight matrix |
Ri <- c(0.5, 1.3) Ci <- c(0.3, 0.7) M <- matrix(c(1, 0, 1, 1), nrow = 2, byrow = TRUE) rj <- c(0.6, 1.2) bppg:::.errorEquation(Ri, Ci, M, rj)Ri <- c(0.5, 1.3) Ci <- c(0.3, 0.7) M <- matrix(c(1, 0, 1, 1), nrow = 2, byrow = TRUE) rj <- c(0.6, 1.2) bppg:::.errorEquation(Ri, Ci, M, rj)
Helper function that extracts the intensity columns and columns of interest from a given dataframe.
.extractIntensities(D, col_pattern, rename_columns).extractIntensities(D, col_pattern, rename_columns)
D |
data.frame |
col_pattern |
character |
rename_columns |
logical |
returns intensity dataframe
Calculate peptide ratios for pairwise comparisons of groups (Y/X).
.foldChange(D, X, Y, useNA = FALSE).foldChange(D, X, Y, useNA = FALSE)
D |
data.frame |
X |
character |
Y |
character |
useNA |
logical |
The fold changes (Y/X).
D <- data.frame(s1 = c(1,4), s2 = c(2,5), s3 = c(3,6)) X <- "s1" Y <- "s2" bppg:::.foldChange(D,X,Y)D <- data.frame(s1 = c(1,4), s2 = c(2,5), s3 = c(3,6)) X <- "s1" Y <- "s2" bppg:::.foldChange(D,X,Y)
Calculate the geometric mean.
.geomMean(x, useprod = FALSE, na.rm = FALSE).geomMean(x, useprod = FALSE, na.rm = FALSE)
x |
numeric vector |
useprod |
logical |
na.rm |
logical |
The geometric mean of the provided data points.
data <- c(1,6,3.5) result <- bppg:::.geomMean(data, useprod = FALSE)data <- c(1,6,3.5) result <- bppg:::.geomMean(data, useprod = FALSE)
Create Mapping signature for igraph::contract function.
.getContractMapping(edgelist, collProtNodes = TRUE, collPeptNodes = FALSE).getContractMapping(edgelist, collProtNodes = TRUE, collPeptNodes = FALSE)
edgelist |
data.frame |
collProtNodes |
logical |
collPeptNodes |
logical |
A list with two dataframes, one for peptide and one for protein signatures.
For collapsing graphs: generateGraphsFromFASTA(), generateQuantGraphs()
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) res <- bppg:::.getContractMapping(edgelist)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) res <- bppg:::.getContractMapping(edgelist)
Calulate initial values for Ci (protein weights) for optimization
.initializeCi(fixedCi, m).initializeCi(fixedCi, m)
fixedCi |
numeric vector |
m |
integer(1) |
If no Ci are fixed, all Ci are initialized with equal weights (1/m). If at least one Ci is fixed, the remaining weight (1 - sum of fixed Ci) is distributed equally among the non-fixed Ci.
Ci_start: vector with initial start values for Ci for the optimization step
# without fixed Ci -> equal starting weights bppg:::.initializeCi(fixedCi = NULL, m = 3) # with fixed Ci -> fixes these and equal weight for the others bppg:::.initializeCi(fixedCi = c(NA, 0.8, NA), m = 3)# without fixed Ci -> equal starting weights bppg:::.initializeCi(fixedCi = NULL, m = 3) # with fixed Ci -> fixes these and equal weight for the others bppg:::.initializeCi(fixedCi = c(NA, 0.8, NA), m = 3)
Calulate initial values for Ri (protein ratios) for optimization
.initializeRi(M, rjLog).initializeRi(M, rjLog)
M |
matrix |
rjLog |
numeric |
For each protein, the mean of the peptide ratios (log2-scale) of the peptides belonging to this protein is calculated. If there are unique peptides for this protein, only those are used.
RiLog_start: vector with inital start values for Ri for the optimization step (log2-scale)
M <- matrix(c(1, 1, 1, 0, 1, 1), ncol = 2, byrow = FALSE) rjLog <- log2(c(0.6, 1.2, 1.5)) bppg:::.initializeRi(M, rjLog)M <- matrix(c(1, 1, 1, 0, 1, 1), ncol = 2, byrow = FALSE) rjLog <- log2(c(0.6, 1.2, 1.5)) bppg:::.initializeRi(M, rjLog)
Enchanced version of the igraph::isomorphic function that also considers the node type in bipartite graphs, e.g. that W- and M-shaped graphs are NOT isomorphic
.isomorphicBipartite(graph1, graph2, ...).isomorphicBipartite(graph1, graph2, ...)
graph1 |
graph (igraph) |
graph2 |
graph (igraph) |
... |
currently unused |
TRUE if graphs are isomorphic, FALSE if not.
M1 <- matrix(c(1, 0, 1, 1), nrow = 2, byrow = TRUE) G1 <- igraph::graph_from_biadjacency_matrix(M1) M2 <- matrix(c(1, 1, 0, 1), nrow = 2, byrow = TRUE) G2 <- igraph::graph_from_biadjacency_matrix(M2) bppg:::.isomorphicBipartite(G1, G2)M1 <- matrix(c(1, 0, 1, 1), nrow = 2, byrow = TRUE) G1 <- igraph::graph_from_biadjacency_matrix(M1) M2 <- matrix(c(1, 1, 0, 1), nrow = 2, byrow = TRUE) G2 <- igraph::graph_from_biadjacency_matrix(M2) bppg:::.isomorphicBipartite(G1, G2)
Function to set up the optimization problem and minimize the sum of squared error terms
.minimizeSquaredError(G, fixedCi = NULL, verbose = FALSE, control = list()).minimizeSquaredError(G, fixedCi = NULL, verbose = FALSE, control = list())
G |
igraph object |
fixedCi |
numeric vector |
verbose |
logical |
control |
list |
list containing the following elements:
RiLog |
estimated protein ratios (Log2-scale) |
Ci |
estimated protein weights |
RES |
final result of |
Tracking |
Tracking of Ri, Ci and error term for the different iterations (-1: no optimization) |
outer.iter |
Number of outer iterations needed for the optimization
algorithm to converge or stop (see also |
convergence |
Indicates whether the solver has converged (0) or
not (1 or 2) (see also |
file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] bppg:::.minimizeSquaredError(G)file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] bppg:::.minimizeSquaredError(G)
Set names for plotting with plotBipartiteGraph.
.setNodeLabels(G, node_labels_peptides, node_labels_proteins, round_digits).setNodeLabels(G, node_labels_peptides, node_labels_proteins, round_digits)
G |
igraph graph object |
node_labels_peptides |
character |
node_labels_proteins |
character |
round_digits |
integer |
Graph with updated names
Funktion to format Tracking information into a dataframe with columnnames.
.trackingDataFrame(i, RES, RiLog, Ci).trackingDataFrame(i, RES, RiLog, Ci)
i |
numeric |
RES |
list |
RiLog |
numeric vector |
Ci |
numeric vector |
\strong{data.frame} \cr
combined information in one data.frame.
Aggregate replicates of the same experimental group.
aggregateReplicates( D, group = NULL, missing.limit = 0, method = "mean", seq_col = "Sequence" )aggregateReplicates( D, group = NULL, missing.limit = 0, method = "mean", seq_col = "Sequence" )
D |
SummarizedExperiment |
group |
character factor |
missing.limit |
numeric |
method |
character |
seq_col |
character |
SummarizedExperiment
A SummarizedExperiment with aggregated intensities ($intensities).
file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- bppg::normalizePeptideIntensities(D) group <- factor(rep(1:9, each = 3)) aggregateReplicates(D_norm, group = group)file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- bppg::normalizePeptideIntensities(D) group <- factor(rep(1:9, each = 3)) aggregateReplicates(D_norm, group = group)
Extract protein ratio solutions from the result of iterateOverCi()
automatedAnalysisIteratedCi( G, res, use_results_from_other_proteins = TRUE, verbose = FALSE, job = NULL, error_tol = 1e-10, ratioLog_tol = 1e-06 )automatedAnalysisIteratedCi( G, res, use_results_from_other_proteins = TRUE, verbose = FALSE, job = NULL, error_tol = 1e-10, ratioLog_tol = 1e-06 )
G |
igraph object |
res |
data.frame |
use_results_from_other_proteins |
logical |
verbose |
logical |
job |
BatchExperiment job object |
error_tol |
numeric(1) |
ratioLog_tol |
numeric(1) |
A SummarizedExperiment object with one row for each protein in the assay.
iterateOverCi(), .minimizeSquaredError()
file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] # small example with a small grid size res <- iterateOverCi(G, gridSize = 100) automatedAnalysisIteratedCi(G, res)file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] # small example with a small grid size res <- iterateOverCi(G, gridSize = 100) automatedAnalysisIteratedCi(G, res)
Calculation of peptide ratios from aggregated intensities.
calculatePeptideRatios(D, group_levels = NULL)calculatePeptideRatios(D, group_levels = NULL)
D |
SummarizedExperiment |
group_levels |
character factor |
A SummarizedExperiment with log2 peptide ratios (logRatios).
file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- bppg::normalizePeptideIntensities(D) dAgg <- aggregateReplicates(D_norm) calculatePeptideRatios(dAgg)file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- bppg::normalizePeptideIntensities(D) dAgg <- aggregateReplicates(D_norm) calculatePeptideRatios(dAgg)
Combine relative quantification results over multiple pairwise comparisons into a single SummarizedExperiments object.
combineComparisons(compResultList)combineComparisons(compResultList)
compResultList |
list |
A SummarizedExperiment object with one assay per comparison. The row names of the assay matrices are the union of all row names across the input SummarizedExperiment objects. For rows that are not present in a given comparison, NA values are introduced. Row names are sorted alphabetically.
# prepared result list. Check "inst/scripts/filter_fasta_and_quantData.R" for # details on how it was generated. file <- system.file("extdata", "resultsList.rds", package = "bppg") resultList <- readRDS(file) SE <- combineComparisons(resultList)# prepared result list. Check "inst/scripts/filter_fasta_and_quantData.R" for # details on how it was generated. file <- system.file("extdata", "resultsList.rds", package = "bppg") resultList <- readRDS(file) SE <- combineComparisons(resultList)
In silico tryptic digestion of whole FASTA file.
digestFASTA( fasta, missed_cleavages = 2, min_aa = 6, max_aa = 50, protOrigin = NULL, verbose = FALSE, ... )digestFASTA( fasta, missed_cleavages = 2, min_aa = 6, max_aa = 50, protOrigin = NULL, verbose = FALSE, ... )
fasta |
list of character sequence |
missed_cleavages |
integer |
min_aa |
integer |
max_aa |
integer |
protOrigin |
list |
verbose |
logical |
... |
Arguments passed on to
|
data.frame with proteins and their peptide sequences, filtered for minimal and maximal number of amino acids.
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) res <- digestFASTA(fasta)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) res <- digestFASTA(fasta)
Export SummarizedExperiment object to an Excel file, with one assay per sheet.
exportSE(SE, file)exportSE(SE, file)
SE |
SummarizedExperiment object |
file |
character |
nothing, but an Excel file is written containing the assay matrices. Each assay is written to a separate sheet, and the sheet name corresponds to the assay name. Row names of the assay matrices are included in the Excel file.
# prepared result list. Check "inst/scripts/filter_fasta_and_quantData.R" for # details on how it was generated. file <- system.file("extdata", "resultsList.rds", package = "bppg") resultList <- readRDS(file) SE <- combineComparisons(resultList) TMP <- tempdir() exportSE(SE, file.path(TMP,"results.xlsx"))# prepared result list. Check "inst/scripts/filter_fasta_and_quantData.R" for # details on how it was generated. file <- system.file("extdata", "resultsList.rds", package = "bppg") resultList <- readRDS(file) SE <- combineComparisons(resultList) TMP <- tempdir() exportSE(SE, file.path(TMP,"results.xlsx"))
Generate bipartite peptide-protein graphs from a list of digested proteins via an edgelist. Peptide and protein nodes can be contracted.
generateGraphsFromEdgelist( edgelist, collProtNodes = FALSE, collPeptNodes = FALSE )generateGraphsFromEdgelist( edgelist, collProtNodes = FALSE, collPeptNodes = FALSE )
edgelist |
data.frame |
collProtNodes |
logical |
collPeptNodes |
logical |
A list of subgraphs as igraph objects.
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) res <- bppg::generateGraphsFromEdgelist(edgelist, collProtNodes = TRUE, collPeptNodes = TRUE)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) res <- bppg::generateGraphsFromEdgelist(edgelist, collProtNodes = TRUE, collPeptNodes = TRUE)
Generate graphs from a FASTA file
generateGraphsFromFASTA( fasta, collProtNodes = TRUE, collPeptNodes = TRUE, outpath = NULL, suffix = NULL, protOrigin = NULL, verbose = FALSE, ... )generateGraphsFromFASTA( fasta, collProtNodes = TRUE, collPeptNodes = TRUE, outpath = NULL, suffix = NULL, protOrigin = NULL, verbose = FALSE, ... )
fasta |
list of vector of chars |
collProtNodes |
logical |
collPeptNodes |
logical |
outpath |
character |
suffix |
character |
protOrigin |
list or data.frame |
verbose |
logical |
... |
Additional arguments to bppg::digestFASTA() |
Subgraphs (i.e. connected components) from the graph generated from the FASTA file.
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) graphs <- bppg::generateGraphsFromFASTA(fasta)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) graphs <- bppg::generateGraphsFromFASTA(fasta)
Generate graphs from quantitative peptide-level data
generateGraphsFromQuantData( D, fasta, outpath = NULL, missed_cleavages = 2, min_aa = 6, max_aa = 50, seq_column = "Sequence", norm_method = "loess", collProtNodes = TRUE, collPeptNodes = FALSE, suffix = "", protOrigin = NULL, verbose = FALSE, ... )generateGraphsFromQuantData( D, fasta, outpath = NULL, missed_cleavages = 2, min_aa = 6, max_aa = 50, seq_column = "Sequence", norm_method = "loess", collProtNodes = TRUE, collPeptNodes = FALSE, suffix = "", protOrigin = NULL, verbose = FALSE, ... )
D |
data.frame |
fasta |
list of vector of characters |
outpath |
character |
missed_cleavages |
integer |
min_aa |
integer |
max_aa |
integer |
seq_column |
character |
norm_method |
character |
collProtNodes |
logical |
collPeptNodes |
logical |
suffix |
character |
protOrigin |
list or data.frame |
verbose |
logical |
... |
Additional arguments for |
A list of list of graphs. The outer list is for the different possible comparisons, the inner layer is for the independet graphs in that comparison.
readMqPeptideTable(), seqinr::read.fasta(),
generateQuantGraphs(), generateGraphsFromFASTA()
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) graphs <- bppg::generateGraphsFromQuantData(D, fasta)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) graphs <- bppg::generateGraphsFromQuantData(D, fasta)
Generate graphs from peptide ratio table, using an edgelist calculated on the fasta file.
generateQuantGraphs( exp_peptide_ratios, fasta_edgelist, seq_column = "Sequence", outpath = NULL, collProtNodes = TRUE, collPeptNodes = FALSE, suffix = "" )generateQuantGraphs( exp_peptide_ratios, fasta_edgelist, seq_column = "Sequence", outpath = NULL, collProtNodes = TRUE, collPeptNodes = FALSE, suffix = "" )
exp_peptide_ratios |
SummarizedExperiment |
fasta_edgelist |
data.frame |
seq_column |
character |
outpath |
character |
collProtNodes |
logical |
collPeptNodes |
logical |
suffix |
character |
A list of list of subgraphs
library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- bppg::normalizePeptideIntensities(D) dAgg <- aggregateReplicates(D_norm) exp_peptide_ratios <- calculatePeptideRatios(dAgg) res <- generateQuantGraphs(exp_peptide_ratios, edgelist)library(seqinr) file <- system.file("extdata", "uniprot_proteome_Scerevisiae_filtered.fasta", package = "bppg") fasta <- seqinr::read.fasta(file = file, seqtype = "AA", as.string = TRUE) edgelist <- digestFASTA(fasta) file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") group <- factor(rep(1:9, each = 3)) D <- readMqPeptideTable(path = file, group = group, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- bppg::normalizePeptideIntensities(D) dAgg <- aggregateReplicates(D_norm) exp_peptide_ratios <- calculatePeptideRatios(dAgg) res <- generateQuantGraphs(exp_peptide_ratios, edgelist)
Iterate over possible Ci values
iterateOverCi( G, gridStart = 0, gridStop = 1, gridSize = 1000, omit_grid_borders = TRUE, extend_grid_at_borders = FALSE, verbose = FALSE, control = list() )iterateOverCi( G, gridStart = 0, gridStop = 1, gridSize = 1000, omit_grid_borders = TRUE, extend_grid_at_borders = FALSE, verbose = FALSE, control = list() )
G |
igraph object |
gridStart |
integer |
gridStop |
integer |
gridSize |
integer |
omit_grid_borders |
logical |
extend_grid_at_borders |
logical |
verbose |
logical |
control |
list |
With .minimizeSquaredError() each protein node receives one estimate for the
protein ratio. However, in some cases, there are multiple possible values for
the protein ratios that lead to the same, minimal error term.
To get a better coverage of the optimal solutions, this function iterates
over a grid of possible weights Ci for each protein node.
For each protein node, the Ci value if fixed on a point on the grid, while
the other Ci values and all Ri values are optimized using
.minimizeSquaredError().
The resulting table can be used to assess a range of possible solutions for
the protein ratios.
The table can be further processed with
automatedAnalysisIteratedCi().
A data.frame containing the optimal Ci and Ri values together with the reached minimal error term for each grid point.
.minimizeSquaredError(),
automatedAnalysisIteratedCi()
file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] # small example with a small grid size iterateOverCi(G, gridSize = 100)file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] # small example with a small grid size iterateOverCi(G, gridSize = 100)
Normalization of peptide intensities
normalizePeptideIntensities( D, method = "loess", lts.quantile = 0.8, log_base = 2 )normalizePeptideIntensities( D, method = "loess", lts.quantile = 0.8, log_base = 2 )
D |
SummarizedExperiment |
method |
character |
lts.quantile |
numeric |
log_base |
numeric |
SummarizedExperiment
Dataset containing normalized peptide intensities.
file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") D <- readMqPeptideTable(path = file, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- normalizePeptideIntensities(D, method = "loess")file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") D <- readMqPeptideTable(path = file, LFQ = TRUE, remove_contaminants = FALSE) D_norm <- normalizePeptideIntensities(D, method = "loess")
Plotting of bipartite peptide-protein graphs.
plotBipartiteGraph( G, legend = TRUE, vertex.color = c("mediumseagreen", "cadetblue2", "coral1"), vertex.size = 15, edge.width = 0.5, node_labels_proteins = "letters", node_labels_peptides = "numbers", round_digits = 2, output_path = NULL, ... )plotBipartiteGraph( G, legend = TRUE, vertex.color = c("mediumseagreen", "cadetblue2", "coral1"), vertex.size = 15, edge.width = 0.5, node_labels_proteins = "letters", node_labels_peptides = "numbers", round_digits = 2, output_path = NULL, ... )
G |
igraph graph object |
legend |
logical |
vertex.color |
character vector |
vertex.size |
numeric |
edge.width |
numeric |
node_labels_proteins |
character |
node_labels_peptides |
character |
round_digits |
integer |
output_path |
character |
... |
Additional arguments for ggsave. |
Plot of one bipartite graph.
file <- system.file("extdata", "quantGraphs_collpept.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] plotBipartiteGraph(G)file <- system.file("extdata", "quantGraphs_collpept.rds", package = "bppg") graphs <- readRDS(file) G <- graphs$"1_2"[[2]] plotBipartiteGraph(G)
Tries to recursively remove protein nodes from graph while keeping the error term in the optimization step low
proteinElimination( G, threshold = 1.05, control = list(), min_error_ref = NULL, resDF = NULL, protsOriginIDs = NULL, res_best = NULL )proteinElimination( G, threshold = 1.05, control = list(), min_error_ref = NULL, resDF = NULL, protsOriginIDs = NULL, res_best = NULL )
G |
igraph graph object |
threshold |
numeric |
control |
list |
min_error_ref |
numeric |
resDF |
data.frame |
protsOriginIDs |
igraph node list |
res_best |
list |
This function works in a recursive way. In the first iteration, the error term on the whole graph is assessed. Then, one of the protein nodes is deleted and the function is recursively applied. The results of all iterations are collected in the resDF data.frame.
For starting the first iteration, only G, threshold and if necessary control have to be defined, everything else will be calculated during the first iteration for all future iterations.
list containing the following elements:
min_error_ref |
reference error term of the whole graph |
protsOriginIDs |
list of all available protein nodes in the beginning |
resDF |
dataframe with results of all iterations |
res_best |
List of the overall best solution. The graph object(s) in this list can directly be used by iterateOverCi. |
## TODO file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs[[1]][[4]] # This graph has 4 protein nodes. proteinElimination(G) # Only 3 protein nodes are kept after protein elimination. # The error term only increases slightly.## TODO file <- system.file("extdata", "quantGraphs.rds", package = "bppg") graphs <- readRDS(file) G <- graphs[[1]][[4]] # This graph has 4 protein nodes. proteinElimination(G) # Only 3 protein nodes are kept after protein elimination. # The error term only increases slightly.
Import of FragPipe's combined_peptide.tsv-table.
readFpPeptideTable( path, group = NULL, rename_columns = TRUE, zeroToNA = TRUE, remove_empty_rows = TRUE, further_columns_to_keep = NULL, verbose = FALSE )readFpPeptideTable( path, group = NULL, rename_columns = TRUE, zeroToNA = TRUE, remove_empty_rows = TRUE, further_columns_to_keep = NULL, verbose = FALSE )
path |
character |
group |
character |
rename_columns |
logical |
zeroToNA |
logical |
remove_empty_rows |
logical |
further_columns_to_keep |
integer vector |
verbose |
logical |
A SummarizedExperiment with intensities, sequences, and optional data for the rowData dataframe.
file <- system.file("extdata", "peptides_FP_filtered.tsv", package = "bppg") D1 <- bppg::readFpPeptideTable(file)file <- system.file("extdata", "peptides_FP_filtered.tsv", package = "bppg") D1 <- bppg::readFpPeptideTable(file)
Import of MaxQuant's peptide.txt-table.
readMqPeptideTable( path, group = NULL, LFQ = FALSE, remove_contaminants = FALSE, rename_columns = TRUE, zeroToNA = TRUE, remove_empty_rows = TRUE, further_columns_to_keep = NULL, verbose = FALSE )readMqPeptideTable( path, group = NULL, LFQ = FALSE, remove_contaminants = FALSE, rename_columns = TRUE, zeroToNA = TRUE, remove_empty_rows = TRUE, further_columns_to_keep = NULL, verbose = FALSE )
path |
character |
group |
character |
LFQ |
logical |
remove_contaminants |
logical |
rename_columns |
logical |
zeroToNA |
logical |
remove_empty_rows |
logical |
further_columns_to_keep |
integer vector |
verbose |
logical |
A SummarizedExperiment with intensities, sequences, and optional data for the rowData dataframe.
file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") D <- readMqPeptideTable(path = file, LFQ = TRUE, remove_contaminants = FALSE)file <- system.file("extdata", "peptides_filtered.txt", package = "bppg") D <- readMqPeptideTable(path = file, LFQ = TRUE, remove_contaminants = FALSE)