From 5ec5574a7001d47368b2e8755ff236c12945a339 Mon Sep 17 00:00:00 2001 From: Laurent Gatto Date: Wed, 9 Oct 2024 16:11:45 +0200 Subject: [PATCH] pRolocmarker versioning --- DESCRIPTION | 2 +- NEWS.md | 5 ++++ R/pRolocmarkers.R | 71 +++++++++++++++++++++++++---------------------- 3 files changed, 44 insertions(+), 34 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b7fbd3b7..c05fe702 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: pRoloc Type: Package Title: A unifying bioinformatics framework for spatial proteomics -Version: 1.45.1 +Version: 1.45.2 Authors@R: c(person(given = "Laurent", family = "Gatto", email = "laurent.gatto@uclouvain.be", role = c("aut","cre")), diff --git a/NEWS.md b/NEWS.md index f36d5b76..32b04c6a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # pRoloc 1.45 +## Changes in version 1.45.2 + +- `pRolocmarkers()` has a new `version` argument, to allow for new + markers versions to be added. + ## Changes in version 1.45.1 - Import 'mclust::estep*()'. diff --git a/R/pRolocmarkers.R b/R/pRolocmarkers.R index f4d3dc42..fbe3b0e8 100644 --- a/R/pRolocmarkers.R +++ b/R/pRolocmarkers.R @@ -2,48 +2,53 @@ ## data is in inst/extdata/marker_species.rda -##' This function retrieves a list of organelle markers or, if no -##' \code{species} is provided, prints a description of available -##' marker sets. The markers can be added to and \code{MSnSet} using -##' the \code{\link{addMarkers}} function. -##' -##' The markers have been contributed by various members of the -##' Cambridge Centre for Proteomics, in particular Dr Dan Nightingale -##' for yeast, Dr Andy Christoforou and Dr Claire Mulvey for human, Dr -##' Arnoud Groen for Arabodopsis and Dr Claire Mulvey for mouse. In -##' addition, original (curated) markers from the \code{pRolocdata} -##' datasets have been extracted (see \code{pRolocdata} for details -##' and references). Curation involved verification of publicly -##' available subcellular localisation annotation based on the -##' curators knowledge of the organelles/proteins considered and -##' tracing the original statement in the literature. -##' -##' These markers are provided as a starting point to generate -##' reliable sets of organelle markers but still need to be verified -##' against any new data in the light of the quantitative data and the -##' study conditions. -##' +##' This function retrieves a list of organelle markers or, if no \code{species} +##' is provided, prints a description of available marker sets. The markers can +##' be added to and \code{MSnSet} using the \code{\link{addMarkers}} function. +##' +##' The markers have been contributed by various members of the Cambridge Centre +##' for Proteomics, in particular Dr Dan Nightingale for yeast, Dr Andy +##' Christoforou and Dr Claire Mulvey for human, Dr Arnoud Groen for Arabodopsis +##' and Dr Claire Mulvey for mouse. In addition, original (curated) markers from +##' the \code{pRolocdata} datasets have been extracted (see \code{pRolocdata} +##' for details and references). Curation involved verification of publicly +##' available subcellular localisation annotation based on the curators +##' knowledge of the organelles/proteins considered and tracing the original +##' statement in the literature. +##' +##' These markers are provided as a starting point to generate reliable sets of +##' organelle markers but still need to be verified against any new data in the +##' light of the quantitative data and the study conditions. +##' ##' @title Organelle markers -##' @param species The species of interest. -##' @return Prints a description of the available marker lists if -##' \code{species} is missing or a named character with organelle -##' markers. +##' +##' @param species `character(1)` defining the species of interest. +##' +##' @param version `character(1)` defining the marker version. +##' +##' @return Prints a description of the available marker lists if \code{species} +##' is missing or a named character with organelle markers. +##' ##' @author Laurent Gatto -##' @seealso \code{\link{addMarkers}} to add markers to an -##' \code{MSnSet} and \code{\link{markers}} for more information about -##' marker encoding. +##' +##' @seealso \code{\link{addMarkers}} to add markers to an \code{MSnSet} and +##' \code{\link{markers}} for more information about marker encoding. +##' ##' @examples ##' pRolocmarkers() ##' table(pRolocmarkers("atha")) ##' table(pRolocmarkers("hsap")) -pRolocmarkers <- function(species) { +pRolocmarkers <- function(species, version = "1") { + prefix <- switch(as.character(version), + "1" = "marker_") fls <- dir(system.file("extdata", package = "pRoloc"), - full.names = TRUE, pattern = "marker_") + full.names = TRUE, pattern = prefix) if (missing(species)) { - cat(length(fls), "marker lists available:\n") + cat(length(fls), " marker lists (version ", version, ") available:\n", + sep = "") for (f in fls) { m <- readRDS(f) - x <- sub(".rds", "", sub("^.+marker_", "", f)) + x <- sub(".rds", "", sub(prefix, "", basename(f))) cat(m$species, " [", x, "]:\n", sep = "") cat(" Ids: ", m$ids, ", ", length(m$markers), " markers\n", sep = "") @@ -52,7 +57,7 @@ pRolocmarkers <- function(species) { if (species == "scer") species <- "scer_uniprot" species <- tolower(species) - x <- sub(".rds", "", sub("^.+marker_", "", fls)) + x <- sub(".rds", "", sub(prefix, "", basename(fls))) k <- match(species, x) if (is.na(k)) stop("Available species: ", paste(x, collapse = ", "),