Skip to content

Commit

Permalink
overall cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Karin Schork committed Sep 12, 2024
1 parent 04dc8ed commit 95b48c5
Show file tree
Hide file tree
Showing 48 changed files with 238 additions and 1,176 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Description: Functionality to create and characterize bipartite graphs that
License: BSD_3_clause + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Imports:
BBmisc,
graphics,
Expand Down
5 changes: 1 addition & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Generated by roxygen2: do not edit by hand

S3method(duplicated,dgCMatrix)
export(Digest2)
export(add_average_pep_ratio)
export(add_uniqueness_attributes)
export(aggregate_replicates)
export(assign_protein_accessions)
export(calculateIsomorphList)
export(calculate_peptide_ratios)
export(calculate_subgraph_characteristics)
export(calculate_subgraph_characteristics_OLD)
export(calculate_summary_table)
export(collapse_edgelist)
export(collapse_edgelist_quant)
Expand All @@ -26,5 +23,5 @@ export(generate_quant_graphs)
export(geom_mean)
export(isomorphic_bipartite)
export(plotBipartiteGraph)
export(plotIsomorphList)
export(read_MQ_peptidetable)
importFrom(igraph,"%->%")
128 changes: 0 additions & 128 deletions R/OLD_helpers_calculate_and_plot_isomorphism_lists.R

This file was deleted.

131 changes: 0 additions & 131 deletions R/OLD_helpers_calculate_and_plot_isomorphism_lists2.R

This file was deleted.

2 changes: 1 addition & 1 deletion R/generate_graphs_from_FASTA.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @param suffix suffix for saving results
#' @param save_intermediate Save intermediate results?
#' @param ... additional arguments to bppg::digest_fasta()

#' @param prot_origin origin of protein, e.g. organism etc.
#'
#' @return subgraphs (i.e. connected components) from the graph generated from the FASTA file.
#' @export
Expand Down
31 changes: 22 additions & 9 deletions R/generate_graphs_from_quantdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#' @param peptide_ratios table with peptide ratios
#' @param id_cols columns with ids, e.g. peptide sequences (everything except the peptide ratios)
#' @param fasta_edgelist Edgelist created from the corresponding FASTA file
#' @param outpath output path
#' @param seq_column column name of the peptide sequence
#' @param collapse_protein_nodes if TRUE protein nodes will be collapsed
#' @param collapse_peptide_nodes if TRUE, peptide nodes will be collapsed
#' @param suffix suffix for output files
#'
#' @return list of list of subgraphs
#' @export
Expand Down Expand Up @@ -72,39 +77,47 @@ generate_quant_graphs <- function(peptide_ratios, id_cols = 1, fasta_edgelist, o
#' (e.g. output from bppg::read_MQ_peptidetable)
#' @param fasta fasta file used for identification of peptides in D
#' @param outpath bla
#' @param normalize currently only loess normalization possible
#' @param missed_cleavages bla
#' @param min_aa bla
#' @param max_aa bla
#' @param ... currently not in use
#' @param id_columns column numbers of D that contain ID information (the rest should contain only peptide intensities, properly normalized)
#' @param seq_column column name of the peptide sequence
#' @param collapse_protein_nodes if TRUE protein nodes will be collapsed
#' @param collapse_peptide_nodes if TRUE, peptide nodes will be collapsed
#' @param suffix suffix for output files
#'
#' @return list of list of graphs
#' @export
#'
#' @examples
generate_graphs_from_quant_data <- function(D, fasta, outpath = NULL, normalize = FALSE,
missed_cleavages = 2, min_aa = 6, max_aa = 50,
id_columns = 1, seq_column = "Sequence",
collapse_protein_nodes = TRUE, collapse_peptide_nodes = FALSE,
generate_graphs_from_quant_data <- function(D,
fasta,
outpath = NULL,
#normalize = FALSE,
missed_cleavages = 2,
min_aa = 6,
max_aa = 50,
id_columns = 1,
seq_column = "Sequence",
collapse_protein_nodes = TRUE,
collapse_peptide_nodes = FALSE,
suffix = "",
...) {

message("Digesting FASTA file...")
digested_proteins <- bppg::digest_fasta(fasta, missed_cleavages = missed_cleavages,
min_aa = min_aa, max_aa = max_aa)#, ...)
min_aa = min_aa, max_aa = max_aa)
message("Generating edgelist ...")
edgelist <- bppg::generate_edgelist(digested_proteins)

if (!is.null(outpath)) {
openxlsx::write.xlsx(edgelist, file = paste0(outpath, "edgelist_fasta_", suffix, ".xlsx"), overwrite = TRUE, keepNA = TRUE)
}


# remove peptides outside the desired length range
D <- D[nchar(D[, seq_column]) >= min_aa & nchar(D[, seq_column]) <= max_aa,]


#normalize Intensities
intensities <- D[,-id_columns]

### aggregate replicates by calculating the mean
Expand Down
3 changes: 2 additions & 1 deletion R/helpers-add_graph_attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ add_uniqueness_attributes <- function(G) {

#' Adds average peptide ratios as a attribute to the graphs, if a list of peptide ratios is already present
#'
#' @param G
#' @param G graph
#' @param type not used at the moment. Default is 'geom_mean'
#'
#' @return graphs with added attributes
#' @export
Expand Down
Loading

0 comments on commit 95b48c5

Please sign in to comment.