Skip to content

Commit

Permalink
Mzion
Browse files Browse the repository at this point in the history
New package name
  • Loading branch information
qzhang503 committed Mar 29, 2023
1 parent 75ce7eb commit d2ca103
Show file tree
Hide file tree
Showing 123 changed files with 910 additions and 926 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: proteoM
Package: mzion
Type: Package
Title: Database Searches of Proteomic Mass-spectrometrirc Data
Version: 1.2.3
Expand Down
22 changes: 11 additions & 11 deletions R/batchMS2.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#'
#' @inheritParams matchMS
#' @export
batch_ms2ions <- function (fasta = c("~/proteoM/dbs/fasta/uniprot/uniprot_hs_2020_05.fasta",
"~/proteoM/dbs/fasta/crap/crap.fasta"),
batch_ms2ions <- function (fasta = c("~/mzion/dbs/fasta/uniprot/uniprot_hs_2020_05.fasta",
"~/mzion/dbs/fasta/crap/crap.fasta"),
fixedmods = c("TMT6plex (N-term)", "TMT6plex (K)",
"Carbamidomethyl (C)"),
varmods = c("Acetyl (Protein N-term)",
Expand All @@ -26,7 +26,7 @@ batch_ms2ions <- function (fasta = c("~/proteoM/dbs/fasta/uniprot/uniprot_hs_202

# ---
if (is.null(.path_cache)) {
.path_cache <- "~/proteoM/.MSearches/Cache/Calls/"
.path_cache <- "~/mzion/.MSearches/Cache/Calls/"
}

.path_cache <- find_dir(.path_cache, create = FALSE)
Expand Down Expand Up @@ -162,7 +162,7 @@ hbatch_ms2ions <- function (ms1_time = NULL, type_ms2ions = "by",
c("gen_ms2ions_base",
"ms2ions_by_type",
"byions", "czions", "axions"),
envir = environment(proteoM:::gen_ms2ions_base)
envir = environment(mzion:::gen_ms2ions_base)
)

ms2s <- parallel::clusterApply(
Expand Down Expand Up @@ -237,7 +237,7 @@ hbatch_ms2ions <- function (ms1_time = NULL, type_ms2ions = "by",
"gen_ms2ions_base",
"ms2ions_by_type",
"byions", "czions", "axions"),
envir = environment(proteoM:::gen_ms2ions_a0_vnl0_fnl1)
envir = environment(mzion:::gen_ms2ions_a0_vnl0_fnl1)
)

ms2s <- parallel::clusterApply(
Expand Down Expand Up @@ -316,7 +316,7 @@ hbatch_ms2ions <- function (ms1_time = NULL, type_ms2ions = "by",
"ms2ions_by_type",
"byions", "czions", "axions",
"add_hexcodes"),
envir = environment(proteoM:::gen_ms2ions_a1_vnl0_fnl0)
envir = environment(mzion:::gen_ms2ions_a1_vnl0_fnl0)
)

ms2s <- parallel::clusterApply(
Expand Down Expand Up @@ -395,7 +395,7 @@ hbatch_ms2ions <- function (ms1_time = NULL, type_ms2ions = "by",
"ms2ions_by_type",
"byions", "czions", "axions",
"add_hexcodes_vnl2"),
envir = environment(proteoM:::gen_ms2ions_a1_vnl1_fnl0)
envir = environment(mzion:::gen_ms2ions_a1_vnl1_fnl0)
)

ms2s <- parallel::clusterApply(
Expand Down Expand Up @@ -475,7 +475,7 @@ hbatch_ms2ions <- function (ms1_time = NULL, type_ms2ions = "by",
"ms2ions_by_type",
"byions", "czions", "axions",
"add_hexcodes_fnl2"),
envir = environment(proteoM:::gen_ms2ions_a1_vnl0_fnl1)
envir = environment(mzion:::gen_ms2ions_a1_vnl0_fnl1)
)

ms2s <- parallel::clusterApply(
Expand Down Expand Up @@ -588,7 +588,7 @@ mgen_ms2ions <- function (ms1s = NULL, aa_masses = NULL,
#' @inheritParams hbatch_ms2ions
#' @inheritParams mgen_ms2ions
make_ms2frames <- function (ms1_time = NULL, ms1s, ms2s,
.path_cache = "~/proteoM/.MSearches/Cache/Calls",
.path_cache = "~/mzion/.MSearches/Cache/Calls",
path_bin2, i)
{
path_time_cache <- file.path(.path_cache, "calc_pepmasses2", ms1_time,
Expand Down Expand Up @@ -684,9 +684,9 @@ make_ms2frames_bypars <- function (pars, ms1s, ms2s, path_bin2, i,
#' @inheritParams make_ms2frames
#' @return Time stamps of MS2 that are yet to be binned.
check_ms2frames <- function (.path_fasta =
"~/proteoM/dbs/fasta/uniprot/uniprot_hs_2020_05",
"~/mzion/dbs/fasta/uniprot/uniprot_hs_2020_05",
ms1_time = NULL,
.path_cache = "~/proteoM/.MSearches/Cache/Calls",
.path_cache = "~/mzion/.MSearches/Cache/Calls",
path_bin2 =
file.path(.path_fasta, "ms2masses", ms1_time, "bin_ms2masses"))
{
Expand Down
10 changes: 5 additions & 5 deletions R/bin_masses.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bin_ms1masses <- function (res = NULL, min_mass = 200L, max_mass = 4500L,
"binTheoSeqs2",
"bin_theoseqs",
"find_ms1_cutpoints"),
envir = environment(proteoM:::binTheoSeqs_i))
envir = environment(mzion:::binTheoSeqs_i))

# No need of flatten() as saveRDS by INDIVIDUAL idx (and return NULL)
parallel::clusterApplyLB(
Expand Down Expand Up @@ -274,10 +274,10 @@ bin_theoseqs <- function (peps = NULL, out_nm = NULL, min_mass = 200L,
#' @param out_path The output path.
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' # res <- readRDS("~/proteoM/dbs/fasta/uniprot/pepmass/uniprot_hs_2020_05_2miss.rds")
#' # theopeps <- proteoM:::binTheoSeqs(res)
#' # res <- readRDS("~/mzion/dbs/fasta/uniprot/pepmass/uniprot_hs_2020_05_2miss.rds")
#' # theopeps <- mzion:::binTheoSeqs(res)
#' }
#' @return Lists of theoretical peptides binned by MS1 masses. The lists
#' correspond to the lists of \code{res}.
Expand Down Expand Up @@ -320,7 +320,7 @@ binTheoSeqs <- function (idxes = NULL, res = NULL, min_mass = 200L,
parallel::clusterExport(cl, list("qread", "qsave"), envir = environment(qs::qsave))

parallel::clusterExport(cl, c("bin_theoseqs", "find_ms1_cutpoints"),
envir = environment(proteoM:::bin_theoseqs))
envir = environment(mzion:::bin_theoseqs))

out <- parallel::clusterMap(cl, bin_theoseqs,
res, file.path(out_dir, out_nms),
Expand Down
62 changes: 31 additions & 31 deletions R/dispatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ find_pos_site <- function (pos)
#' @seealso contain_protntany
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Protein N-term = P`
#' sites <- list(`Dimethyl (Protein N-term = P)` = "P",
Expand All @@ -62,9 +62,9 @@ find_pos_site <- function (pos)
#' posns <- names(vmods)
#' # stopifnot(identical(positions, posns))
#'
#' stopifnot(proteoM:::contain_protntsite(vmods, names(vmods), length(vmods)))
#' stopifnot(mzion:::contain_protntsite(vmods, names(vmods), length(vmods)))
#'
#' ans <- proteoM:::find_protntsite(vmods, posns)
#' ans <- mzion:::find_protntsite(vmods, posns)
#' stopifnot(identical(ans, vmods[1]))
#' }
find_protntsite <- find_pos_site("Protein N-term")
Expand All @@ -77,7 +77,7 @@ find_protntsite <- find_pos_site("Protein N-term")
#' @rdname find_protntsite
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## Gln->pyro Glu (N-term = Q)
#' sites <- list(`Gln->pyro Glu (N-term = Q)` = "Q",
Expand All @@ -91,9 +91,9 @@ find_protntsite <- find_pos_site("Protein N-term")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' stopifnot(proteoM:::contain_anyntsite(vmods, posns, length(vmods)))
#' stopifnot(mzion:::contain_anyntsite(vmods, posns, length(vmods)))
#'
#' ans <- proteoM:::find_anyntsite(vmods, posns)
#' ans <- mzion:::find_anyntsite(vmods, posns)
#' stopifnot(identical(ans, vmods[1])) # M and N
#' }
find_anyntsite <- find_pos_site("Any N-term")
Expand All @@ -120,7 +120,7 @@ find_anyntsite <- find_pos_site("Any N-term")
#'
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Oxidation (M)` and `Deamidated (N)`
#' sites <- list(`Acetyl (N-term)` = "N-term",
Expand All @@ -133,9 +133,9 @@ find_anyntsite <- find_pos_site("Any N-term")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' stopifnot(proteoM:::contain_anysite(vmods, posns, length(vmods)))
#' stopifnot(mzion:::contain_anysite(vmods, posns, length(vmods)))
#'
#' ans <- proteoM:::find_anysite(vmods, posns)
#' ans <- mzion:::find_anysite(vmods, posns)
#' stopifnot(length(ans) == 2L)
#'
#'
Expand All @@ -153,7 +153,7 @@ find_anyntsite <- find_pos_site("Any N-term")
#' posns <- names(vmods)
#' stopifnot(length(posns) < length(positions))
#'
#' ans <- proteoM:::find_anysite(vmods, posns)
#' ans <- mzion:::find_anysite(vmods, posns)
#' stopifnot(length(ans) == 2L)
#' }
find_anysite <- find_pos_site("Anywhere")
Expand All @@ -167,7 +167,7 @@ find_anysite <- find_pos_site("Anywhere")
#'
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Dehydrated (Protein C-term = N)`
#' sites <- list(`Dehydrated (Protein C-term = N)` = "N",
Expand All @@ -181,9 +181,9 @@ find_anysite <- find_pos_site("Anywhere")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' stopifnot(proteoM:::contain_protctsite(vmods, posns, length(vmods)))
#' stopifnot(mzion:::contain_protctsite(vmods, posns, length(vmods)))
#'
#' ans <- proteoM:::find_protctsite(vmods, posns)
#' ans <- mzion:::find_protctsite(vmods, posns)
#' stopifnot(identical(ans, vmods[1]))
#' }
find_protctsite <- find_pos_site("Protein C-term")
Expand All @@ -196,7 +196,7 @@ find_protctsite <- find_pos_site("Protein C-term")
#' @rdname find_protntsite
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Oxidation (C-term = G)`
#' sites <- list(`Oxidation (C-term = G)` = "G",
Expand All @@ -210,9 +210,9 @@ find_protctsite <- find_pos_site("Protein C-term")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' stopifnot(proteoM:::contain_anyctsite(vmods, posns, length(vmods)))
#' stopifnot(mzion:::contain_anyctsite(vmods, posns, length(vmods)))
#'
#' ans <- proteoM:::find_anyctsite(vmods, posns)
#' ans <- mzion:::find_anyctsite(vmods, posns)
#' stopifnot(identical(ans, vmods[1]))
#' }
find_anyctsite <- find_pos_site("Any C-term")
Expand Down Expand Up @@ -319,7 +319,7 @@ contain_termpos_any <- function (pos)
#' @inheritParams find_nmodtree
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Acetyl (Protein N-term)`
#' sites <- list(`Acetyl (Protein N-term)` = "N-term",
Expand All @@ -332,7 +332,7 @@ contain_termpos_any <- function (pos)
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' proteoM:::contain_protntany(vmods, posns, length(vmods))
#' mzion:::contain_protntany(vmods, posns, length(vmods))
#' }
contain_protntany <- contain_termpos_any("Protein N-term")

Expand All @@ -344,7 +344,7 @@ contain_protntany <- contain_termpos_any("Protein N-term")
#' @rdname contain_protntany
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Acetyl (N-term)`
#' sites <- list(`Acetyl (N-term)` = "N-term",
Expand All @@ -357,7 +357,7 @@ contain_protntany <- contain_termpos_any("Protein N-term")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' proteoM:::contain_anyntany(vmods, posns, length(vmods))
#' mzion:::contain_anyntany(vmods, posns, length(vmods))
#' }
contain_anyntany <- contain_termpos_any("Any N-term")

Expand All @@ -369,7 +369,7 @@ contain_anyntany <- contain_termpos_any("Any N-term")
#' @rdname contain_protntany
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Amidated (Protein C-term)`
#' sites <- list(`Amidated (Protein C-term)` = "C-term",
Expand All @@ -382,7 +382,7 @@ contain_anyntany <- contain_termpos_any("Any N-term")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' proteoM:::contain_protctany(vmods, posns, length(vmods))
#' mzion:::contain_protctany(vmods, posns, length(vmods))
#' }
contain_protctany <- contain_termpos_any("Protein C-term")

Expand All @@ -394,7 +394,7 @@ contain_protctany <- contain_termpos_any("Protein C-term")
#' @rdname contain_protntany
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## `Amidated (C-term)`
#' sites <- list(`Amidated (C-term)` = "C-term",
Expand All @@ -407,7 +407,7 @@ contain_protctany <- contain_termpos_any("Protein C-term")
#' vmods <- unlist(vmods, recursive = FALSE, use.names = TRUE)
#' posns <- names(vmods)
#'
#' proteoM:::contain_anyctany(vmods, posns, length(vmods))
#' mzion:::contain_anyctany(vmods, posns, length(vmods))
#' }
contain_anyctany <- contain_termpos_any("Any C-term")

Expand Down Expand Up @@ -453,7 +453,7 @@ subset_by_prps <- function (ps, s, motifs)
#' @inheritParams find_nmodtree
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#' library(purrr)
#'
#' ## Protein N-term (Site)
Expand All @@ -471,7 +471,7 @@ subset_by_prps <- function (ps, s, motifs)
#' PROT_B = c("PAKEKASSPECFUN", "NKAKEKASSPECFU",
#' "-NKAKEKASSPECFU"))
#'
#' proteoM:::subset_protntsite(prps, proteoM:::find_protntsite(vmods, posns))
#' mzion:::subset_protntsite(prps, mzion:::find_protntsite(vmods, posns))
#' }
subset_protntsite <- function (prps, site, motifs = NULL)
{
Expand All @@ -497,7 +497,7 @@ subset_protntany <- function (prps, motifs = NULL)
#' @rdname subset_protntsite
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## Any N-term (Site)
#' sites <- list(`Dimethyl (N-term = P)` = "P",
Expand All @@ -515,7 +515,7 @@ subset_protntany <- function (prps, motifs = NULL)
#' "-NKAKEKASSPECFU"))
#'
#' # "-PAKEKASSPECFUN" went with `subset_protntsite` (see flow charts)
#' proteoM:::subset_anyntsite(prps, proteoM:::find_anyntsite(vmods, posns))
#' mzion:::subset_anyntsite(prps, mzion:::find_anyntsite(vmods, posns))
#' }
subset_anyntsite <- function (prps, site = "Q", motifs = NULL)
{
Expand All @@ -539,7 +539,7 @@ subset_anyntany <- function (peps) peps
#' @inheritParams find_nmodtree
#' @examples
#' \donttest{
#' library(proteoM)
#' library(mzion)
#'
#' ## Anywhere
#' min_n_res <- c(P = 1, M = 1, N = 1)
Expand All @@ -558,7 +558,7 @@ subset_anyntany <- function (peps) peps
#' "-NKAKEKASSPECFU"))
#'
#' # should contain both M and N
#' proteoM:::subset_anysite(prps, sites, min_n_res)
#' mzion:::subset_anysite(prps, sites, min_n_res)
#'
#' ## Multiple mods to the same site
#' # (mimic from aa_masses)
Expand Down Expand Up @@ -586,7 +586,7 @@ subset_anyntany <- function (peps) peps
#' PROT_B = c("PAKEKASSPECFUN", "NKAKEKASSPECFU",
#' "-NKAKEKASSPECFU"))
#'
#' ans <- proteoM:::subset_anysite(prps, sites, min_n_res)
#' ans <- mzion:::subset_anysite(prps, sites, min_n_res)
#' }
subset_anysite <- function (prps, sites, min_n_res, motifs = NULL, excepts = NULL)
{
Expand Down
Loading

0 comments on commit d2ca103

Please sign in to comment.