Skip to content

Commit

Permalink
v1.2.5.2
Browse files Browse the repository at this point in the history
Updated user-interface utilities;
Additional optimization in search speed.
  • Loading branch information
qzhang503 committed May 17, 2023
1 parent c3c54a4 commit 4a9130e
Show file tree
Hide file tree
Showing 34 changed files with 762 additions and 675 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mzion
Type: Package
Title: Database Searches of Proteomic Mass-spectrometrirc Data
Version: 1.2.5
Version: 1.2.5.2
Authors@R:
person(given = "Qiang",
family = "Zhang",
Expand Down
112 changes: 50 additions & 62 deletions R/funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# [6] "check_ms2frames"
#
# $bin_masses.R
# [1] "bin_ms1masses" "binTheoSeqs_i" "binTheoSeqs2" "bin_theoseqs" "binTheoSeqs"
# [6] "find_ms1_cutpoints" "s_readRDS"
# [1] "bin_ms1masses" "binTheoSeqs_i" "binTheoSeqs2" "bin_theoseqs" "binTheoSeqs" "find_ms1_cutpoints"
# [7] "s_readRDS"
#
# $dispatch.R
# [1] "find_pos_site" "contain_pos_site" "contain_termpos_any" "subset_by_prps" "subset_protntsite"
Expand All @@ -19,23 +19,21 @@
# character(0)
#
# $ion_ladder.R
# [1] "ms2ions_by_type" "byions" "czions" "axions" "bions_base" "yions_base"
# [7] "b2ions_base" "bstarions" "bstar2ions" "b0ions" "b02ions" "y2ions"
# [13] "ystarions" "ystar2ions" "y0ions" "y02ions" "cions_base" "c2ions"
# [19] "zions_base" "z2ions" "aions_base" "a2ions" "astarions" "astar2ions"
# [25] "a0ions" "a02ions" "xions_base" "x2ions"
# [1] "ms2ions_by_type" "byions" "czions" "axions" "bions_base" "yions_base" "b2ions_base"
# [8] "bstarions" "bstar2ions" "b0ions" "b02ions" "y2ions" "ystarions" "ystar2ions"
# [15] "y0ions" "y02ions" "cions_base" "c2ions" "zions_base" "z2ions" "aions_base"
# [22] "a2ions" "astarions" "astar2ions" "a0ions" "a02ions" "xions_base" "x2ions"
#
# $mapMS2ions.R
# [1] "mapMS2ions" "match_mgf_path" "match_raw_id" "add_raw_ids"
# [5] "find_secion_types" "find_psm_rows" "find_psm_rows1" "find_psm_rows2"
# [9] "find_theoexpt_pair" "find_mgf_query" "combine_prisec_matches" "check_existed_psms"
# [13] "get_mzion_coltypes"
# [1] "mapMS2ions" "match_mgf_path" "match_raw_id" "add_raw_ids" "find_secion_types"
# [6] "find_psm_rows" "find_psm_rowsQ" "find_psm_rowsC" "find_theoexpt_pair" "find_mgf_query"
# [11] "combine_prisec_matches" "check_existed_psms" "get_mzion_coltypes"
#
# $mgfs.R
# [1] "load_mgfs" "readMGF" "post_readmgf" "readlineMGFs" " f"
# [6] "read_mgf_chunks" "proc_mgf_chunks" "proc_mgfs" "sub_mgftopn" "integerize_ms2ints"
# [11] "extract_mgf_rptrs" "find_ms1_interval" "index_mz" "find_mgf_type" "readmzML"
# [16] "proc_mzml" "read_mzml"
# [1] "load_mgfs" "readMGF" "post_readmgf" "readlineMGFs" " f" "read_mgf_chunks"
# [7] "proc_mgf_chunks" "proc_mgfs" "sub_mgftopn" "integerize_ms2ints" "extract_mgf_rptrs" "find_ms1_interval"
# [13] "index_mz" "find_mgf_type" "readmzML" "proc_mzml" "read_mzml" "prepBrukerMGF"
# [19] "mprepBrukerMGF"
#
# $ms1_precursors.R
# [1] "calc_pepmasses2" "find_aa_masses" "find_motif_pat" "simple_prots_peps"
Expand All @@ -54,29 +52,21 @@
# [53] "delta_ms1_a0_fnl1" "hms1_a0_vnl0_fnl1" "ms1_a0_vnl0_fnl1" "hms1_a1_vnl0_fnl0"
# [57] "ms1_a1_vnl0_fnl0"
#
# $ms2_a0_vnl0_fnl1.R
# [1] "ms2match_a0_vnl0_fnl1" "gen_ms2ions_a0_vnl0_fnl1"
# $ms2_gen.R
# [1] "gen_ms2ions_base" "gen_ms2ions_a0_vnl0_fnl1" "gen_ms2ions_a1_vnl0_fnl0" "calc_ms2ions_a1_vnl0_fnl0"
# [5] "check_ms1_mass_vmods2" "add_hexcodes" "gen_ms2ions_a1_vnl0_fnl1" "calc_ms2ions_a1_vnl0_fnl1"
# [9] "add_hexcodes_fnl2" "gen_ms2ions_a1_vnl1_fnl0" "calc_ms2ions_a1_vnl1_fnl0" "add_hexcodes_vnl2"
#
# $ms2_a1_vnl0_fnl0.R
# [1] "ms2match_a1_vnl0_fnl0" "gen_ms2ions_a1_vnl0_fnl0" "calc_ms2ions_a1_vnl0_fnl0" "check_ms1_mass_vmods2"
# [5] "add_hexcodes"
#
# $ms2_a1_vnl0_fnl1.R
# [1] "ms2match_a1_vnl0_fnl1" "gen_ms2ions_a1_vnl0_fnl1" "calc_ms2ions_a1_vnl0_fnl1" "add_hexcodes_fnl2"
#
# $ms2_a1_vnl1_fnl0.R
# [1] "ms2match_a1_vnl1_fnl0" "gen_ms2ions_a1_vnl1_fnl0" "calc_ms2ions_a1_vnl1_fnl0" "add_hexcodes_vnl2"
#
# $ms2_base.R
# [1] "ms2match_base" "frames_adv" "gen_ms2ions_base" "fuzzy_match_one" "fuzzy_match_one2" "find_ms2_bypep"
# [7] "search_mgf"
# $ms2frames.R
# [1] "pair_mgftheo" "hms2match" "ms2match_all" "mframes_adv" "fuzzy_match_one" "fuzzy_match_one2"
# [7] "find_ms2_bypep" "search_mgf" "ms2match_one" "frames_adv"
#
# $msmsmatches.R
# [1] "matchMS" "try_psmC2Q" "reproc_psmC" "psmC2Q" "post_psmC2Q" "check_tmt_pars"
# [7] "checkMGF" "check_locmods" "map_raw_n_scan" "check_fdr_group"
# [1] "matchMS" "try_psmC2Q" "reproc_psmC" "psmC2Q" "post_psmC2Q" "check_tmt_pars" "checkMGF"
# [8] "check_locmods" "map_raw_n_scan" "check_fdr_group"
#
# $msmsmatches2.R
# [1] "ms2match" "hcalc_tmtint" "reverse_peps_in_frame" "reverse_seqs" "calib_ms1masses"
# [1] "ms2match" "reverse_peps_in_frame" "reverse_seqs" "calib_mgf" "calib_ms1"
#
# $mzion.R
# character(0)
Expand All @@ -85,29 +75,28 @@
# [1] "make_mztab"
#
# $percolator.R
# [1] "creat_folds" "cv_svm" "perco_svm" "probco_bypepcharge" "calc_z_pepfdr"
# [1] "creat_folds" "cv_svm" "perco_svm"
#
# $quant2.R
# [1] "calc_tmtint" "add_rptrs" "find_reporter_ints" "find_reporters_ppm" "msub_protpep"
# [6] "sub_protpep" "add_protacc2" "add_protacc" "hannot_decoys" "groupProts"
# [11] "map_pepprot" "collapse_sortpeps" "pcollapse_sortpeps" "chunksplit_spmat" "find_group_breaks"
# [16] "cut_proteinGroups" "sparseD_fourquad" "as_dist" "as_lgldist" "greedysetcover3"
# [1] "hcalc_tmtint" "calc_tmtint" "add_rptrs" "find_reporter_ints" "find_reporters_ppm" "msub_protpep"
# [7] "sub_protpep" "add_protacc2" "add_protacc" "hannot_decoys" "groupProts" "map_pepprot"
# [13] "collapse_sortpeps" "pcollapse_sortpeps" "chunksplit_spmat" "find_group_breaks" "cut_proteinGroups" "sparseD_fourquad"
# [19] "as_dist" "greedysetcover3"
#
# $roadmaps.R
# character(0)
#
# $scores.R
# [1] "add_seions" "list_leftmatch" "calc_probi_byvmods" "calc_probi_bypep"
# [5] "calc_probi" "scalc_pepprobs" "calc_pepprobs_i" "calc_pepscores"
# [9] "find_decoy" "find_targets" "calcpepsc" "add_primatches"
# [13] "collapse_vecs" "post_pepscores" "find_pepscore_co1" "find_pepscore_co2"
# [17] "probco_bypeplen" "sub_td_byfdrtype" "find_optlens" "find_probco_valley"
# [21] "prep_pepfdr_td" "keep_pepfdr_best" "calc_pepfdr" "fill_probco_nas"
# [25] "fill_probs" "post_pepfdr" "calc_protfdr" "aggr_prot_es"
# [29] "calc_protfdr_i" "fit_protfdr" " f" "find_ppm_outer_bycombi"
# [33] "match_ex2th2" "calc_peploc" "calcpeprank_1" "calcpeprank_2"
# [37] "calcpeprank_3" "find_chunkbreaks" "findLocFracsDF" "concatFracs"
# [41] "na.interp" "is.constant" "tsoutliers"
# [1] "add_seions" "list_leftmatch" "calc_probi_byvmods" "calc_probi_bypep" "calc_probi"
# [6] "scalc_pepprobs" "calc_pepprobs_i" "calc_pepscores" "split_im" "order_fracs"
# [11] "combine_fracs" "move_scfiles" "find_decoy" "find_targets" "calcpepsc"
# [16] "hadd_primatches" "add_primatches" "collapse_vecs" "post_pepscores" "find_pepscore_co1"
# [21] "find_pepscore_co2" "probco_bypeplen" "sub_td_byfdrtype" "find_optlens" "find_probco_valley"
# [26] "prep_pepfdr_td" "keep_pepfdr_best" "calc_pepfdr" "fill_probco_nas" "fill_probs"
# [31] "post_pepfdr" "calc_protfdr" "aggr_prot_es" "calc_protfdr_i" "fit_protfdr"
# [36] " f" "find_ppm_outer_bycombi" "match_ex2th2" "calc_peploc" "calcpeprank_1"
# [41] "calcpeprank_2" "calcpeprank_3" "find_chunkbreaks" "findLocFracsDF" "concatFracs"
# [46] "na.interp" "is.constant" "tsoutliers"
#
# $silac.R
# [1] "matchMS_silac_mix" "matchMS_par_groups" "add_fixedlab_masses" "matchMS_noenzyme" "combine_ion_matches"
Expand All @@ -122,22 +111,21 @@
#
# $utils_engine.R
# [1] "which_topx" "which_topx2" "get_topn_vals" "insVal" "topx"
# [6] "find_ppm_error" "find_mass_error_range" "`%+%`" "post_ms2match" "`%+%`"
# [11] "post_frame_adv" "purge_search_space" "subset_theoframes" "subset_neuloss_peps" "find_nterm_mass"
# [16] "find_cterm_mass" "quick_rightjoin" "quick_leftjoin" "detect_cores" "find_free_mem"
# [21] "find_mod_indexes" "is_equal_sets" "expand_grid_rows" "count_elements" "vec_to_list"
# [26] "split_vec" "accumulate_char" "combi_mat" "make_zero_df" "calc_threeframe_ppm"
# [31] "check_ms1calib" "save_ms1calib" "get_ms1charges" "finds_uniq_vec" "my_dataframe"
# [6] "find_ppm_error" "find_mass_error_range" "`%+%`" "`%+%`" "post_frame_adv"
# [11] "subset_theoframes" "subset_neuloss_peps" "find_nterm_mass" "find_cterm_mass" "quick_rightjoin"
# [16] "quick_leftjoin" "detect_cores" "find_free_mem" "find_mod_indexes" "is_equal_sets"
# [21] "expand_grid_rows" "expand_grid" "expand_grid_rows0" "count_elements" "vec_to_list"
# [26] "split_vec" "fold_vec" "rep_vec" "accumulate_char" "combi_mat"
# [31] "make_zero_df" "calc_threeframe_ppm" "get_ms1charges" "finds_uniq_vec" "my_dataframe"
# [36] "flatten_list" "calc_rev_ms2" "bind_dfs"
#
# $utils_os.R
# [1] "`names_pos<-`" "find_int_cols" "ins_cols_after" "add_cols_at"
# [5] "replace_cols_at" "reloc_col_after" "reloc_col_after_last" "reloc_col_after_first"
# [9] "reloc_col_before" "reloc_col_before_last" "reloc_col_before_first" "find_preceding_colnm"
# [13] "recur_flatten" "chunksplit" "chunksplitLB" "find_dir"
# [17] "create_dir" "save_call2" "find_callarg_vals" "match_calltime"
# [21] "delete_files" "find_ms1_times" "get_globalvar" "load_cache_info"
# [25] "is_nulllist" "add_nulllist"
# [1] "`names_pos<-`" "find_int_cols" "ins_cols_after" "add_cols_at" "replace_cols_at"
# [6] "reloc_col_after" "reloc_col_after_last" "reloc_col_after_first" "reloc_col_before" "reloc_col_before_last"
# [11] "reloc_col_before_first" "find_preceding_colnm" "recur_flatten" "chunksplit" "chunksplitLB"
# [16] "find_dir" "create_dir" "save_call2" "find_callarg_vals" "match_calltime"
# [21] "delete_files" "find_ms1_times" "get_globalvar" "load_cache_info" "is_nulllist"
# [26] "add_nulllist"
#
# $utils_ui.R
# [1] "calc_monopeptide" "calc_monopep" "check_aaseq" "calc_ms2ionseries" "calc_ms2ions" "unique_mvmods"
Expand Down
15 changes: 10 additions & 5 deletions R/mapMS2ions.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,14 @@ find_secion_types <- function (type_ms2ions = "by")
find_psm_rows <- function (file_t0, file_t1, file_t2, file_t3, scan, raw_file,
rank = 1L, is_decoy = FALSE)
{
psm <- find_psm_rows1(file_t1 = file_t1, file_t2 = file_t2, file_t3 = file_t3,
psm <- find_psm_rowsQ(file_t1 = file_t1, file_t2 = file_t2, file_t3 = file_t3,
scan = scan, raw_file = raw_file, rank = rank,
is_decoy = is_decoy)

nrow <- nrow(psm)

if (!nrow) {
psm <- find_psm_rows2(file_t0 = file_t0, scan = scan, raw_file = raw_file,
psm <- find_psm_rowsC(file_t0 = file_t0, scan = scan, raw_file = raw_file,
rank = rank, is_decoy = is_decoy)
nrow <- nrow(psm)
}
Expand All @@ -288,7 +288,7 @@ find_psm_rows <- function (file_t0, file_t1, file_t2, file_t3, scan, raw_file,
#' Extracts the first row of matched PSMs from tiers 1-3.
#'
#' @inheritParams find_psm_rows
find_psm_rows1 <- function (file_t1, file_t2, file_t3, scan, raw_file,
find_psm_rowsQ <- function (file_t1, file_t2, file_t3, scan, raw_file,
rank = 1L, is_decoy = FALSE)
{
ok <- any(ls(all.names = TRUE, envir = .GlobalEnv) == ".psms")
Expand Down Expand Up @@ -343,7 +343,7 @@ find_psm_rows1 <- function (file_t1, file_t2, file_t3, scan, raw_file,
#' Extracts the first row of matched PSMs from psmC.
#'
#' @inheritParams find_psm_rows
find_psm_rows2 <- function (file_t0, scan, raw_file, rank = 1L,
find_psm_rowsC <- function (file_t0, scan, raw_file, rank = 1L,
is_decoy = FALSE)
{
ok <- any(ls(all.names = TRUE, envir = .GlobalEnv) == ".psmC")
Expand Down Expand Up @@ -384,6 +384,7 @@ find_theoexpt_pair <- function (psm, out_path, scan, raw_id, is_decoy = FALSE)
if (! x %in% col_nms) stop("PSM column not found: ", x)
})

# is.na(psm$pep_ivmod) with decoy entries
pep_seq <- psm$pep_seq
pep_ivmod <- psm$pep_ivmod

Expand Down Expand Up @@ -455,6 +456,9 @@ find_theoexpt_pair <- function (psm, out_path, scan, raw_id, is_decoy = FALSE)
theoexpt <- ion_match$matches[[1]]

# (1) matched by `pep_seq`
if (is_decoy)
names(theoexpt) <- reverse_seqs(names(theoexpt))

theoexpt <- theoexpt[names(theoexpt) == pep_seq]

if (length(theoexpt) > 1L) {
Expand All @@ -467,7 +471,8 @@ find_theoexpt_pair <- function (psm, out_path, scan, raw_id, is_decoy = FALSE)

# (2) matched by pep_ivmod
# (pep_seq matched but can still have multiple pep_ivmod's)
theoexpt <- theoexpt[names(theoexpt) == pep_ivmod]
if (!is_decoy)
theoexpt <- theoexpt[names(theoexpt) == pep_ivmod]

# (can have multiple NLs)
if (length(theoexpt) > 1L) {
Expand Down
Loading

0 comments on commit 4a9130e

Please sign in to comment.