annotate PMD_FDR_package_for_Galaxy.R @ 0:5cc0c32d05a2 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
author galaxyp
date Mon, 07 Oct 2019 11:59:37 -0400
parents
children 460edeedeb7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2 # PMD_FDR_package_for_Galaxy.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
4 # Project 021 - PMD-FDR for Galaxy-P #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
5 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
6 # Description: Computes iFDR and gFDR on PSMs as a script designed for Galaxy #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
7 # Note that plotting code has been left in that is not used #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
8 # in this file; this is the code I used to create figures for #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
9 # publication. I left it in for potential development of views. #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
10 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
11 # This file was created by concatenating the following files: #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
12 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
13 # A - 005 - Parser - ArgParser.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
14 # B - 019 - PMD-FDR - functions.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
15 # C - 021 - PMD-FDR Wrapper - functions.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
16 # D - 021 - PMD-FDR Main.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
17 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
18 # Required packages: argparser #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
19 # stringr #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
20 # RUnit #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
21 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
22 # Release date: 2019-10-05 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
23 # Version: 1.4 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
24 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
25 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
26 # Package currently supports the following parameters:
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
27 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
28 # --psm_report full name and path to the PSM report
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
29 # --psm_report_1_percent full name and path to the PSM report for 1% FDR
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
30 # --output_i_fdr full name and path to the i-FDR output file
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
31 # --output_g_fdr full name and path to the g-FDR output file
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
32 # --output_densities full name and path to the densities output file
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
33 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
34 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
35 # A - 005 - Parser - ArgParser.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
36 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
37 # Description: Wrapper for argparser package, using RefClass #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
38 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
39 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
40
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
41 #install.packages("argparser")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
42 library(argparser)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
43
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
44 # Class definition
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
45
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
46 ArgParser <- setRefClass("ArgParser",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
47 fields = c("parser"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
48 ArgParser$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
49 initialize = function(...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
50 parser <<- arg_parser(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
51 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
52 local_add_argument = function(...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
53 parser <<- add_argument(parser, ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
54 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
55 parse_arguments = function(...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
56 result = parse_args(parser, ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
57 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
58 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
59 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
60
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
61 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
62 # B - 019 - PMD-FDR - functions.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
63 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
64 # Primary work-horse for PMD-FDR #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
65 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
66 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
67 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
68 ####### Load libraries etc.
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
69 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
70 library(stringr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
71 library(RUnit)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
72
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
73 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
74 ####### Global values (should be parameters to module but aren't yet)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
75 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
76
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
77 MIN_GOOD_PEPTIDE_LENGTH <- 11
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
78 MIN_ACCEPTABLE_POINTS_IN_DENSITY <- 10
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
79
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
80 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
81 ####### General purpose functions
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
82 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
83 # Creates a more useful error report when file is not reasonable
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
84 safe_file_exists <- function(file_path){ # Still not particularly useful in cases where it is a valid directory
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
85 tryCatch(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
86 return(file_test(op = "-f", x=file_path)),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
87 error=function(e) {simpleError(sprintf("file path is not valid: '%s'", file_path))}
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
88 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
89 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
90 # My standard way of loading data into data.frames
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
91 load_standard_df <- function(file_path=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
92 clean_field_names = function(field_names){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
93 result <- field_names
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
94 idx_blank <- which(result == "")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
95 result[idx_blank] <- sprintf("<Field %d>", idx_blank)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
96 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
97 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
98 if (safe_file_exists(file_path)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
99 field_names <- read_field_names(file_path, sep = "\t")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
100 field_names <- clean_field_names(field_names)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
101
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
102 if (length(field_names) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
103 return(data.frame())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
104 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
105 data <- read.table(file = file_path, header = TRUE, sep = "\t", stringsAsFactors = FALSE, blank.lines.skip = TRUE)#, check.names = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
106 colnames(data) = field_names
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
107 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
108 stop(sprintf("File path does not exist: '%s'", file_path))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
109 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
110 return(data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
111 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
112 save_standard_df <- function(x=NULL, file_path=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
113 if (file_path != ""){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
114 write.table(x = x, file = file_path, quote = FALSE, sep = "\t", row.names = FALSE, col.names = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
115 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
116 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
117 rename_column <- function(df=NULL, name_before=NULL, name_after=NULL, suppressWarnings=FALSE){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
118 if (is.null(df)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
119 stop("Dataframe (df) does not exist - unable to rename column")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
120 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
121 if (name_before %in% colnames(df)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
122 df[,name_after] <- df[,name_before]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
123 df[,name_before] <- NULL
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
124 } else if (!suppressWarnings){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
125 warning(sprintf("'%s' is not a field in the data frame and so has not been renamed", name_before))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
126 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
127 return(df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
128 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
129 rename_columns <- function(df=NULL, names_before=NULL, names_after=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
130 for (i in safe_iterator(length(names_before))){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
131 df <- rename_column(df, names_before[i], names_after[i])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
132 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
133 return(df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
134 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
135 round_to_tolerance <- function(x=NULL, tolerance=NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
136 return(function_to_tolerance(x=x, tolerance=tolerance, FUN=round, ...))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
137 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
138 function_to_tolerance <- function(x=NULL, tolerance=NULL, FUN=NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
139 return(FUN(x/tolerance, ...) * tolerance)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
140 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
141 safe_median <- function(x) median(x, na.rm=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
142 normalize_density <- function(d){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
143 # Normalizes y-values in density function
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
144 # so that the integral under the curve is 1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
145 # (uses rectangles to approximate area)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
146 delta_x <- diff(range(d$x)) / length(d$x)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
147 unnormalized_integral <- delta_x * sum(d$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
148 new_d <- d
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
149 new_d$y <- with(new_d, y )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
150
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
151 return(new_d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
152 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
153 if_null <- function(cond=NULL, null_result=NULL, not_null_result=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
154 return(switch(1+is.null(cond),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
155 not_null_result,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
156 null_result))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
157 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
158 rainbow_with_fixed_intensity <- function(n=NULL, goal_intensity_0_1=NULL, alpha=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
159 goal_intensity <- 255*goal_intensity_0_1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
160 hex_colors <- rainbow(n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
161 rgb_colors <- col2rgb(hex_colors)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
162 df_colors <- data.frame(t(rgb_colors))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
163 df_colors$intensity <- with(df_colors, 0.2989*red + 0.5870*green + 0.1140*blue)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
164
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
165 df_colors$white_black <- with(df_colors, ifelse(intensity < goal_intensity, 255, 0))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
166 df_colors$mix_level <- with(df_colors, (white_black - goal_intensity) / (white_black - intensity ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
167 df_colors$new_red <- with(df_colors, mix_level*red + (1-mix_level)*white_black)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
168 df_colors$new_green <- with(df_colors, mix_level*green + (1-mix_level)*white_black)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
169 df_colors$new_blue <- with(df_colors, mix_level*blue + (1-mix_level)*white_black)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
170 names_pref_new <- c("new_red", "new_green", "new_blue")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
171 names_no_pref <- c("red", "green", "blue")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
172 df_colors <- df_colors[,names_pref_new]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
173 df_colors <- rename_columns(df_colors, names_before = names_pref_new, names_after = names_no_pref)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
174 rgb_colors <-as.matrix(df_colors/255 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
175
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
176 return(rgb(rgb_colors, alpha=alpha))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
177 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
178 safe_iterator <- function(n_steps = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
179 if (n_steps < 1){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
180 result = numeric(0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
181 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
182 result = 1:n_steps
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
183 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
184 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
185 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
186 col2hex <- function(cols=NULL, col_alpha=255){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
187 if (all(col_alpha<=1)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
188 col_alpha <- round(col_alpha*255)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
189 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
190 col_matrix <- t(col2rgb(cols))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
191 results <- rgb(col_matrix, alpha=col_alpha, maxColorValue = 255)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
192 return(results)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
193 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
194 credible_interval <- function(x=NULL, N=NULL, precision=0.001, alpha=0.05){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
195 # Approximates "highest posterior density interval"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
196 # Uses exact binomial but with a finite list of potential values (1/precision)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
197
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
198 p <- seq(from=0, to=1, by=precision)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
199 d <- dbinom(x = x, size = N, prob = p)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
200 d <- d / sum(d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
201 df <- data.frame(p=p, d=d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
202 df <- df[order(-df$d),]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
203 df$cumsum <- cumsum(df$d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
204 max_idx <- sum(df$cumsum < (1-alpha)) + 1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
205 max_idx <- min(max_idx, nrow(df))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
206
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
207 lower <- min(df$p[1:max_idx])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
208 upper <- max(df$p[1:max_idx])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
209
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
210 return(c(lower,upper))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
211 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
212 verified_element_of_list <- function(parent_list=NULL, element_name=NULL, object_name=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
213 if (is.null(parent_list[[element_name]])){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
214 if (is.null(object_name)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
215 object_name = "the list"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
216 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
217 stop(sprintf("Element '%s' does not yet exist in %s", element_name, object_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
218 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
219 return(parent_list[[element_name]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
220 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
221 read_field_names = function(file_path=NULL, sep = "\t"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
222 con = file(file_path,"r")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
223 fields = readLines(con, n=1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
224 close(con)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
225
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
226 if (length(fields) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
227 return(c())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
228 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
229 fields = strsplit(x = fields, split = sep)[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
230 return(fields)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
231 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
232 check_field_name = function(input_df = NULL, name_of_input_df=NULL, field_name=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
233 test_succeeded <- field_name %in% colnames(input_df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
234 current_columns <- paste0(colnames(input_df), collapse=", ")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
235 checkTrue(test_succeeded,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
236 msg = sprintf("Expected fieldname '%s' in %s (but did not find it among %s)",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
237 field_name, name_of_input_df, current_columns))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
238 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
239
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
240 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
241 ####### Classes for Data
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
242 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
243
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
244 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
245 # Class: Data_Object
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
246 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
247 Data_Object <- setRefClass("Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
248 fields =list(m_is_dirty = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
249 parents = "list",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
250 children = "list",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
251 class_name = "character"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
252 Data_Object$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
253 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
254 m_is_dirty <<- TRUE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
255 class_name <<- "Data_Object <abstract class - class_name needs to be set in subclass>"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
256 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
257 load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
258 #print(sprintf("Calling %s$load_data()", class_name)) # Useful for debugging
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
259 ensure_parents()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
260 verify()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
261 m_load_data()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
262 set_dirty(new_value = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
263 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
264 ensure = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
265 if (m_is_dirty){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
266 load_data()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
267 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
268 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
269 set_dirty = function(new_value){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
270 if (new_value != m_is_dirty){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
271 m_is_dirty <<- new_value
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
272 set_children_dirty()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
273 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
274 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
275 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
276 stop(sprintf("verify() is an abstract method - define it in %s before calling load_data()", class_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
277 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
278 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
279 stop(sprintf("m_load_data() is an abstract method - define it in %s before calling load_data()", class_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
280 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
281 append_parent = function(parent=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
282 parents <<- append(parents, parent)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
283 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
284 append_child = function(child=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
285 children <<- append(children, child)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
286 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
287 ensure_parents = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
288 for (parent in parents){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
289 # print(sprintf("Calling %s$ensure()", parent$class_name)) # Useful for debugging
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
290 parent$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
291 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
292 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
293 set_children_dirty = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
294 for (child in children){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
295 child$set_dirty(TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
296 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
297 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
298 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
299 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
300 # Class: Data_Object_Info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
301 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
302 Data_Object_Info <- setRefClass("Data_Object_Info",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
303 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
304 fields =list(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
305 data_file_name_1_percent_FDR = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
306 data_file_name = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
307 data_path_name = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
308 experiment_name = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
309 designation = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
310
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
311 input_file_type = "character"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
312
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
313 #score_field_name = "character"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
314 #collection_name="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
315 #dir_results="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
316 #dir_dataset="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
317 #dataset_designation="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
318 #file_name_dataset="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
319 #file_name_dataset_1_percent="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
320 #experiment_name="character"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
321 ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
322 Data_Object_Info$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
323 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
324 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
325 class_name <<- "Data_Object_Info - <Abstract class - class_name needs to be set in subclass>"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
326 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
327 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
328 checkFieldExists = function(field_name=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
329 field_value <- .self[[field_name]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
330 checkTrue(length(field_value) > 0,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
331 sprintf("Field %s$%s has not been set (and should have been)", class_name, field_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
332 checkTrue(length(field_value) == 1,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
333 sprintf("Field %s$%s has been set to multiple values (and should be a single value)", class_name, field_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
334 checkTrue(field_value != "",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
335 sprintf("Field %s$%s has been set to an empty string (and should not have been)", class_name, field_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
336 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
337 checkFieldExists("data_file_name")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
338 checkFieldExists("data_path_name")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
339 checkFieldExists("experiment_name")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
340 checkFieldExists("designation")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
341 checkFieldExists("input_file_type")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
342 #checkFieldExists("score_field_name")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
343 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
344 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
345 # Nothing to do - this is really a data class
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
346 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
347 file_path = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
348 result <- file.path(data_path_name, data_file_name)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
349 if (length(result) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
350 stop("Unable to validate file path - one or both of path name and file name are missing")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
351 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
352 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
353 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
354 file_path_1_percent_FDR = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
355 local_file_name <- get_data_file_name_1_percent_FDR()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
356 if (length(local_file_name) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
357 result <- ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
358 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
359 result <- file.path(data_path_name, local_file_name)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
360 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
361
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
362 # Continue even if file name is missing - not all analyses have a 1 percent FDR file; this is managed downstream
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
363
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
364 # if (length(result) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
365 # stop("Unable to validate file path - one or both of path name and file name (of 1 percent FDR file) are missing")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
366 # }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
367 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
368 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
369 get_data_file_name_1_percent_FDR = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
370 return(data_file_name_1_percent_FDR)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
371 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
372 collection_name = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
373 result <- sprintf("%s_%s", experiment_name, designation)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
374 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
375 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
376 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
377 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
378 # Class: Data_Object_Info_737_two_step
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
379 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
380 Data_Object_Info_737_two_step <- setRefClass("Data_Object_Info_737_two_step",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
381 contains = "Data_Object_Info",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
382 fields =list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
383 Data_Object_Info_737_two_step$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
384 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
385 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
386 class_name <<- "Data_Object_Info_737_two_step"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
387 #score_field_name <<- "Confidence [%]"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
388 data_file_name_1_percent_FDR <<- "737_NS_Peptide_Shaker_PSM_Report_Multi_Stage_Two_Step.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
389 data_file_name <<- "737_NS_Peptide_Shaker_Extended_PSM_Report_Multi_Stage_Two_Step.tabular.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
390 data_path_name <<- file.path(".", "Data")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
391 experiment_name <<- "Oral_737_NS"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
392 designation <<- "two_step"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
393
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
394 input_file_type <<- "PSM_Report"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
395
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
396 #data_collection_oral_737_NS_combined$file_name_dataset_1_percent = "737_NS_Peptide_Shaker_PSM_Report_CombinedDB.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
397 #data_collection_oral_737_NS_two_step$file_name_dataset_1_percent = "737_NS_Peptide_Shaker_PSM_Report_Multi_Stage_Two_Step.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
398
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
399 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
400 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
401
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
402 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
403 # Class: Data_Object_Info_737_combined
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
404 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
405 Data_Object_Info_737_combined <- setRefClass("Data_Object_Info_737_combined",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
406 contains = "Data_Object_Info",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
407 fields =list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
408 Data_Object_Info_737_combined$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
409 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
410 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
411 class_name <<- "Data_Object_Info_737_combined"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
412 #score_field_name <<- "Confidence [%]"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
413 data_file_name_1_percent_FDR <<- "737_NS_Peptide_Shaker_PSM_Report_CombinedDB.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
414 data_file_name <<- "737_NS_Peptide_Shaker_Extended_PSM_Report_CombinedDB.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
415 data_path_name <<- file.path(".", "Data")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
416 experiment_name <<- "Oral_737_NS"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
417 designation <<- "two_step"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
418
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
419 input_file_type <<- "PSM_Report"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
420
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
421 #data_collection_oral_737_NS_combined$file_name_dataset_1_percent = "737_NS_Peptide_Shaker_PSM_Report_CombinedDB.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
422 #data_collection_oral_737_NS_two_step$file_name_dataset_1_percent = "737_NS_Peptide_Shaker_PSM_Report_Multi_Stage_Two_Step.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
423
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
424 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
425 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
426
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
427 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
428 # Class: Data_Object_Pyrococcus_tr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
429 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
430 Data_Object_Pyrococcus_tr <- setRefClass("Data_Object_Pyrococcus_tr",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
431 contains = "Data_Object_Info",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
432 fields =list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
433 Data_Object_Pyrococcus_tr$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
434 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
435 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
436 class_name <<- "Data_Object_Pyrococcus_tr"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
437 #score_field_name <<- "Confidence [%]"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
438 data_file_name_1_percent_FDR <<- ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
439 data_file_name <<- "Pfu_traditional_Extended_PSM_Report.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
440 data_path_name <<- file.path(".", "Data")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
441 experiment_name <<- "Pyrococcus"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
442 designation <<- "tr"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
443
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
444 input_file_type <<- "PSM_Report"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
445
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
446 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
447 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
448 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
449 # Class: Data_Object_Mouse_Mutations
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
450 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
451 Data_Object_Mouse_Mutations <- setRefClass("Data_Object_Mouse_Mutations",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
452 contains = "Data_Object_Info",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
453 fields =list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
454 Data_Object_Mouse_Mutations$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
455 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
456 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
457 class_name <<- "Data_Object_Mouse_Mutations"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
458 #score_field_name <<- "Confidence [%]"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
459 data_file_name_1_percent_FDR <<- ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
460 data_file_name <<- "Combined_DB_Mouse_5PTM.tabular"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
461 data_path_name <<- file.path(".", "Data")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
462 experiment_name <<- "Mouse Mutations"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
463 designation <<- "combined_05"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
464
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
465 input_file_type <<- "PSM_Report"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
466
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
467 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
468 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
469 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
470 # Class: Data_Object_Raw_Data
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
471 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
472 Data_Object_Raw_Data <- setRefClass("Data_Object_Raw_Data",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
473 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
474 fields =list(df = "data.frame"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
475 Data_Object_Raw_Data$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
476 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
477 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
478 class_name <<- "Data_Object_Raw_Data"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
479 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
480 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
481 # Check that file exists before using it
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
482 file_path <- get_info()$file_path()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
483 if (! safe_file_exists(file_path)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
484 stop(sprintf("Raw data file does not exist (%s)", file_path))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
485 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
486 # BUGBUG: Needs to also check the following:
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
487 # - file is tab-delimited
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
488 # - first row is a list of column names
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
489 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
490 set_info = function(info){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
491 parents[["info"]] <<- info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
492 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
493 get_info = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
494 return(verified_element_of_list(parents, "info", "Data_Object_Raw_Data$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
495 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
496 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
497 info <- get_info()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
498 df <<- load_standard_df(info$file_path())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
499 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
500 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
501 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
502 # Class: Data_Object_Raw_1_Percent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
503 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
504 Data_Object_Raw_1_Percent <- setRefClass("Data_Object_Raw_1_Percent",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
505 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
506 fields =list(df = "data.frame"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
507 Data_Object_Raw_1_Percent$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
508 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
509 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
510 class_name <<- "Data_Object_Raw_1_Percent"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
511 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
512 set_info = function(info){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
513 parents[["info"]] <<- info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
514 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
515 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
516 # Do nothing - a missing file name is acceptable for this module and is dealt with in load()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
517 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
518 get_info = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
519 return(verified_element_of_list(parents, "info", "Data_Object_Raw_1_Percent$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
520 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
521 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
522
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
523 info <- get_info()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
524 file_path <- info$file_path_1_percent_FDR()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
525 if (exists()){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
526 df <<- load_standard_df(info$file_path_1_percent_FDR())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
527 } # Note that failing to load is a valid state for this file, leading to not is_dirty. BUGBUG: this could lead to problems if a good file appears later
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
528 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
529 exists = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
530
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
531 info <- get_info()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
532 local_file_name <- info$get_data_file_name_1_percent_FDR() # Check file name not file path
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
533
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
534 if (length(local_file_name) == 0 ){ # variable not set
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
535 result = FALSE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
536 } else if (local_file_name == ""){ # variable set to empty string
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
537 result = FALSE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
538 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
539 result = safe_file_exists(info$file_path_1_percent_FDR())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
540 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
541
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
542 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
543 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
544 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
545 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
546 # Class: Data_Converter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
547 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
548 Data_Converter <- setRefClass("Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
549 fields =list(class_name = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
550 file_type = "character"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
551 ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
552 Data_Converter$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
553 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
554 class_name <<- "Data_Converter <abstract class - class_name needs to be set in subclass>"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
555 file_type <<- "file_type has not been set before being used <needs to be set in initialize() of subclass>"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
556 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
557 check_raw_fields = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
558 stop(sprintf("check_raw_fields() is an abstract method - define it in %s before calling Data_Object_Data_Converter$load_data()", class_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
559 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
560 convert_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
561 stop(sprintf("convert_data() is an abstract method - define it in %s before calling Data_Object_Data_Converter$load_data()", class_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
562 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
563 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
564 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
565 # Class: Data_Converter_PMD_FDR_input_file
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
566 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
567 Data_Converter_PMD_FDR_input_file <- setRefClass("Data_Converter_PMD_FDR_input_file",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
568 contains = "Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
569 fields =list(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
570
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
571 ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
572 Data_Converter_PMD_FDR_input_file$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
573 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
574 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
575
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
576 class_name <<- "Data_Converter_PMD_FDR_input_file"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
577 file_type <<- "PMD_FDR_file_type"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
578 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
579 check_raw_fields = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
580 data_original <- raw_data$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
581 check_field_name(data_original, "raw_data", "PMD_FDR_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
582 check_field_name(data_original, "raw_data", "PMD_FDR_pmd")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
583 check_field_name(data_original, "raw_data", "PMD_FDR_spectrum_file")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
584 check_field_name(data_original, "raw_data", "PMD_FDR_proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
585 check_field_name(data_original, "raw_data", "PMD_FDR_spectrum_title")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
586 check_field_name(data_original, "raw_data", "PMD_FDR_sequence")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
587 check_field_name(data_original, "raw_data", "PMD_FDR_decoy")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
588 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
589 convert_data = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
590 data_new <- raw_data$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
591
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
592 return(data_new) # Pass through - everything should be in order
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
593 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
594 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
595 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
596 # Class: Data_Converter_PSM_Report
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
597 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
598 Data_Converter_PSM_Report <- setRefClass("Data_Converter_PSM_Report",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
599 contains = "Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
600 fields =list(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
601
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
602 ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
603 Data_Converter_PSM_Report$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
604 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
605 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
606
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
607 class_name <<- "Data_Converter_PSM_Report"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
608 file_type <<- "PSM_Report"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
609 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
610 check_raw_fields = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
611 data_original <- raw_data$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
612 check_field_name(data_original, "raw_data", "Confidence [%]")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
613 check_field_name(data_original, "raw_data", "Precursor m/z Error [ppm]")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
614 check_field_name(data_original, "raw_data", "Spectrum File")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
615 check_field_name(data_original, "raw_data", "Protein(s)")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
616 check_field_name(data_original, "raw_data", "Spectrum Title")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
617 check_field_name(data_original, "raw_data", "Decoy")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
618 check_field_name(data_original, "raw_data", "Sequence")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
619
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
620 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
621 convert_data = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
622 data_new <- raw_data$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
623
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
624 data_new$PMD_FDR_input_score <- data_new[, "Confidence [%]" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
625 data_new$PMD_FDR_pmd <- data_new[, "Precursor m/z Error [ppm]"]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
626 data_new$PMD_FDR_spectrum_file <- data_new[, "Spectrum File" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
627 data_new$PMD_FDR_proteins <- data_new[, "Protein(s)" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
628 data_new$PMD_FDR_spectrum_title <- data_new[, "Spectrum Title" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
629 data_new$PMD_FDR_sequence <- data_new[, "Sequence" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
630 data_new$PMD_FDR_decoy <- data_new[, "Decoy" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
631
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
632 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
633 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
634 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
635 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
636 # Class: Data_Converter_MaxQuant_Evidence
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
637 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
638 Data_Converter_MaxQuant_Evidence <- setRefClass("Data_Converter_MaxQuant_Evidence",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
639 contains = "Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
640 fields =list(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
641
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
642 ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
643 Data_Converter_MaxQuant_Evidence$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
644 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
645 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
646
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
647 class_name <<- "Data_Converter_MaxQuant_Evidence"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
648 file_type <<- "MaxQuant_Evidence"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
649 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
650 check_raw_fields = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
651 data_original <- raw_data$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
652
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
653 check_field_name(data_original, "raw_data", "PEP")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
654 check_field_name(data_original, "raw_data", "Mass error [ppm]")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
655 check_field_name(data_original, "raw_data", "Proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
656 check_field_name(data_original, "raw_data", "Retention time")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
657 check_field_name(data_original, "raw_data", "Sequence")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
658 check_field_name(data_original, "raw_data", "Reverse")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
659 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
660 convert_data = function(info=NULL, raw_data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
661 data_new <- raw_data$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
662
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
663 data_new$PMD_FDR_input_score <- 100 * (1 - data_new[, "PEP" ])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
664 data_new$PMD_FDR_pmd <- data_new[, "Mass error [ppm]"]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
665 data_new$PMD_FDR_spectrum_file <- "<place_holder - assumes a single spectra file>"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
666 data_new$PMD_FDR_proteins <- data_new[, "Proteins" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
667 data_new$PMD_FDR_spectrum_title <- data_new[, "Retention time" ] # Used for ordering peptides - not important in MaxQuant since PMD has already been normalized effectively
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
668 data_new$PMD_FDR_sequence <- data_new[, "Sequence" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
669 data_new$PMD_FDR_decoy <- ifelse( data_new[, "Reverse" ] == "+", 1, 0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
670
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
671 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
672 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
673 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
674
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
675 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
676 # Class: Data_Object_Data_Converter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
677 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
678 Data_Object_Data_Converter <- setRefClass("Data_Object_Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
679 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
680 fields =list(df = "data.frame",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
681 data_converter = "Data_Converter"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
682 Data_Object_Data_Converter$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
683 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
684 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
685 class_name <<- "Data_Object_Data_Converter"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
686 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
687 currently_supported_file_types = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
688 return(c("PSM_Report", "PMD_FDR_input_file"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
689 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
690 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
691 info <- get_info()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
692 raw_data <- get_raw_data()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
693 file_type <- get_info()$input_file_type
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
694
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
695 set_file_type(file_type)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
696 data_converter$check_raw_fields(info=info, raw_data=raw_data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
697
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
698 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
699 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
700
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
701 info <- get_info()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
702 raw_data <- get_raw_data()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
703 file_type <- get_info()$input_file_type
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
704
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
705 df <<- data_converter$convert_data(info=info, raw_data=raw_data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
706
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
707 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
708 set_file_type = function(file_type = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
709 if (file_type == "PSM_Report" ){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
710 data_converter <<- Data_Converter_PSM_Report $new()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
711 } else if (file_type == "PMD_FDR_input_file"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
712 data_converter <<- Data_Converter_PMD_FDR_input_file$new()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
713 } else if (file_type == "MaxQuant_Evidence"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
714 data_converter <<- Data_Converter_MaxQuant_Evidence $new()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
715 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
716 stop(sprintf("File type '%s' is not currently supported by PMD-FDR module", file_type))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
717 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
718 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
719 set_info = function(info){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
720 parents[["info"]] <<- info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
721 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
722 get_info = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
723 return(verified_element_of_list(parents, "info", "Data_Object_Data_Converter$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
724 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
725 set_raw_data = function(raw_data){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
726 parents[["raw_data"]] <<- raw_data
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
727 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
728 get_raw_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
729 return(verified_element_of_list(parents, "raw_data", "Data_Object_Data_Converter$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
730 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
731 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
732 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
733 # Class: Data_Object_Groupings
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
734 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
735 Data_Object_Groupings <- setRefClass("Data_Object_Groupings",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
736 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
737 fields =list(df = "data.frame"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
738 Data_Object_Groupings$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
739 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
740 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
741 class_name <<- "Data_Object_Groupings"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
742 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
743 simplify_field_name = function(x=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
744 result <- gsub(pattern = "PMD_FDR_", replacement = "", x = x)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
745 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
746 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
747 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
748 data_original <- get_data_converter()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
749
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
750 check_field_name(data_original, "data_converter", "PMD_FDR_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
751 check_field_name(data_original, "data_converter", "PMD_FDR_pmd")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
752 check_field_name(data_original, "data_converter", "PMD_FDR_spectrum_file")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
753 check_field_name(data_original, "data_converter", "PMD_FDR_proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
754 check_field_name(data_original, "data_converter", "PMD_FDR_spectrum_title")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
755 check_field_name(data_original, "data_converter", "PMD_FDR_sequence")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
756 check_field_name(data_original, "data_converter", "PMD_FDR_decoy")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
757
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
758 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
759 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
760 make_data_groups <- function(data_original=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
761
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
762 # Functions supporting make_data_groups()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
763
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
764 standardize_fields <- function(data=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
765 data_new <- data
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
766
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
767 info <- get_info()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
768 info$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
769 #field_name_of_score <- info$get_field_name_of_score()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
770
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
771 # #data_new <- rename_column(data_new, "Variable Modifications" , "ptm_list")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
772 # data_new <- rename_column(data_new, field_name_of_score , "PMD_FDR_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
773 # data_new <- rename_column(data_new, "Precursor m/z Error [ppm]", "PMD_FDR_pmd")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
774 # #data_new <- rename_column(data_new, "Isotope Number" , "isotope_number")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
775 # #data_new <- rename_column(data_new, "m/z" , "m_z")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
776 # #data_new <- rename_column(data_new, "Measured Charge" , "charge")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
777 # data_new <- rename_column(data_new, "Spectrum File" , "PMD_FDR_spectrum_file")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
778 # data_new <- rename_column(data_new, "Protein(s)" , "PMD_FDR_proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
779 # data_new <- rename_column(data_new, "Spectrum Title" , "PMD_FDR_spectrum_title")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
780 # data_new <- manage_decoy_column(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
781
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
782 # Now managed in Data_Converter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
783 # data_new$PMD_FDR_input_score <- data_new[, field_name_of_score ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
784 # data_new$PMD_FDR_pmd <- data_new[, "Precursor m/z Error [ppm]"]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
785 # data_new$PMD_FDR_spectrum_file <- data_new[, "Spectrum File" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
786 # data_new$PMD_FDR_proteins <- data_new[, "Protein(s)" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
787 # data_new$PMD_FDR_spectrum_title <- data_new[, "Spectrum Title" ]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
788
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
789 data_new$value <- data_new$PMD_FDR_pmd
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
790 data_new$PMD_FDR_peptide_length <- str_length(data_new$PMD_FDR_sequence)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
791 #data_new$charge_value <- with(data_new, as.numeric(substr(charge, start=1, stop=str_length(charge)-1)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
792 #data_new$measured_mass <- with(data_new, m_z*charge_value)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
793 data_new$PMD_FDR_spectrum_index <- NA
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
794 data_new$PMD_FDR_spectrum_index[order(data_new$PMD_FDR_spectrum_title, na.last = TRUE)] <- 1:nrow(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
795
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
796 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
797 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
798 add_grouped_variable <- function(data_groups = data_groups, field_name_to_group = NULL, vec.length.out = NULL, vec.tolerance = NULL, value_format = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
799
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
800 # Support functions for add_grouped_variable()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
801 find_interval_vec <- function(x=NULL, length.out = NULL, tolerance = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
802 q <- quantile(x = x, probs = seq(from=0, to=1, length.out = length.out), na.rm=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
803 q <- round_to_tolerance(q, tolerance = tolerance)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
804 return(q)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
805 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
806 get_group_data_frame <- function(vec=NULL, value_format = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
807 n <- length(vec)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
808 a <- vec[-n]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
809 b <- vec[-1]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
810
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
811 lower <- ifelse(a == b , "eq", NA)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
812 lower <- ifelse(is.na(lower ), "ge", lower)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
813 upper <- ifelse(a == b , "eq", NA)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
814 upper[n-1] <- ifelse(is.na(upper[n-1]), "le", "eq")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
815 upper <- ifelse(is.na(upper ), "lt", upper)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
816 group <- data.frame(list(idx=1:(n-1), a=a, b=b, lower=lower, upper=upper))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
817
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
818 name_format <- sprintf("%%%s_%%%s_%%s_%%s", value_format, value_format)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
819 group$new_var <- with(group, sprintf(name_format, a, b, lower, upper))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
820
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
821 return(group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
822 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
823 merge_group_with_data <- function(data_groups = NULL, group = NULL, vec = NULL, field_name_to_group = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
824 field_name_new <- sprintf("group_%s", simplify_field_name(field_name_to_group))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
825 group_idx <- findInterval(x = data_groups[,field_name_to_group],
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
826 vec = vec,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
827 all.inside=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
828 data_groups$new_var <- group$new_var[group_idx]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
829 data_groups <- rename_column(data_groups, "new_var", field_name_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
830 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
831 # Body of add_grouped_variable()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
832
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
833 vec <- find_interval_vec(x = data_groups[[field_name_to_group]],
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
834 length.out = vec.length.out,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
835 tolerance = vec.tolerance )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
836 group <- get_group_data_frame(vec = vec,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
837 value_format = value_format)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
838 df_new <- merge_group_with_data(data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
839 group = group,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
840 vec = vec,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
841 field_name_to_group = field_name_to_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
842 df_new <- add_group_decoy(df_new, field_name_to_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
843
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
844 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
845 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
846 add_already_grouped_variable <- function(field_name_to_group = NULL, data_groups = NULL ){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
847 old_name <- field_name_to_group
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
848 new_name <- sprintf("group_%s", simplify_field_name(old_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
849 df_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
850 df_new[[new_name]] <- data_groups[[old_name]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
851
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
852 df_new <- add_group_decoy(data_groups = df_new, field_name_to_group = field_name_to_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
853
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
854 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
855 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
856 add_value_norm <- function(data_groups = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
857
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
858 df_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
859 df_new$value_norm <- with(df_new, value - median_of_group_index)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
860
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
861 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
862 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
863 add_protein_group <-function(data_groups = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
864 data_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
865 df_group_def <- data.frame(stringsAsFactors = FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
866 list(pattern = c("" , "pfu_" , "cRAP"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
867 group_name = c("human", "pyrococcus", "contaminant")))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
868 for (i in 1:nrow(df_group_def)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
869 idx <- grepl(pattern = df_group_def$pattern[i],
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
870 x = data_new$PMD_FDR_proteins)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
871 data_new$group_proteins[idx] <- df_group_def$group_name[i]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
872 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
873
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
874 data_new <- add_group_decoy(data_groups = data_new, field_name_to_group = "PMD_FDR_proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
875 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
876 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
877 add_group_decoy <- function(data_groups=NULL, field_name_to_group=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
878 simple_field_name <- simplify_field_name(field_name_to_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
879 field_name_decoy <- sprintf("group_decoy_%s", simple_field_name)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
880 field_name_group <- sprintf("group_%s", simple_field_name)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
881
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
882 data_groups[[field_name_decoy]] <- with(data_groups, ifelse(PMD_FDR_decoy, "decoy", data_groups[[field_name_group]]))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
883
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
884 return(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
885 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
886 add_group_training_class <- function(data_groups = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
887 df_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
888
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
889 lowest_confidence_group <- min(data_groups$group_input_score)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
890
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
891 is_long_enough <- with(df_new, (PMD_FDR_peptide_length >= MIN_GOOD_PEPTIDE_LENGTH) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
892 is_good <- with(df_new, (PMD_FDR_decoy == 0) & (PMD_FDR_input_score == 100) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
893 is_bad <- with(df_new, (PMD_FDR_decoy == 1) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
894 #is_used_to_train <- with(df_new, used_to_find_middle) # BUGBUG: circular definition
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
895
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
896 idx_good <- which(is_good ) # & is_long_enough)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
897 n_good <- length(idx_good)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
898 idx_testing <- idx_good[c(TRUE,FALSE)] # Selects every other item
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
899 idx_training <- setdiff(idx_good, idx_testing)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
900
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
901 #is_good_short <- with(df_new, is_good & !is_long_enough )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
902 #is_good_long <- with(df_new, is_good & is_long_enough )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
903 is_bad_short <- with(df_new, is_bad & !is_long_enough )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
904 is_bad_long <- with(df_new, is_bad & is_long_enough )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
905 #is_good_training <- with(df_new, is_good_long & (used_to_find_middle == TRUE ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
906 #is_good_testing <- with(df_new, is_good_long & (used_to_find_middle == FALSE) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
907
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
908 df_new$group_training_class <- "other_short" # Default
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
909 df_new$group_training_class[is_long_enough ] <- "other_long" # Default (if long enough)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
910 df_new$group_training_class[idx_training ] <- "good_training" # Length does not matter (anymore)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
911 df_new$group_training_class[idx_testing ] <- "good_testing" # Ditto
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
912 #df_new$group_training_class[is_good_short ] <- "good_short"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
913 df_new$group_training_class[is_bad_long ] <- "bad_long" # ...except for "bad"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
914 df_new$group_training_class[is_bad_short ] <- "bad_short"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
915
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
916 df_new <- add_used_to_find_middle( data_groups = df_new ) # Guarantees consistency between duplicated definitions
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
917
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
918 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
919 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
920 add_used_to_find_middle <- function(data_groups = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
921 df_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
922 idx_used <- which(data_groups$group_training_class == "good_training")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
923
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
924 df_new$used_to_find_middle <- FALSE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
925 df_new$used_to_find_middle[idx_used] <- TRUE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
926
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
927 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
928 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
929 add_group_spectrum_index <- function(data_groups = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
930
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
931 # Supporting functions for add_group_spectrum_index()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
932
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
933 get_breaks_all <- function(df_new){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
934 # Supporting function(s) for get_breaks_all()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
935
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
936 get_cut_points <- function(data_subset){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
937
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
938 # Supporting function(s) for get_cut_points()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
939
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
940 cut_values <- function(data=NULL, minimum_segment_length=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
941 # using cpt.mean -- Appears to have a memory leak
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
942 #results_cpt <- cpt.mean(data=data, method="PELT", minimum_segment_length=minimum_segment_length)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
943 #results <- results_cpt@cpts
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
944
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
945 # Just look at the end
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
946 #results <- c(length(data))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
947
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
948 # regularly spaced, slightly larger than minimum_segment_length
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
949 n_points <- length(data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
950 n_regions <- floor(n_points / minimum_segment_length)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
951 n_regions <- ifelse(n_regions == 0, 1, n_regions)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
952 results <- round(seq(1, n_points, length.out = n_regions + 1))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
953 results <- results[-1]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
954 return(results)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
955 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
956 remove_last <- function(x){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
957 return(x[-length(x)] )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
958 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
959
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
960 # Main code of for get_cut_points()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
961 max_idx = max(data_subset$PMD_FDR_spectrum_index)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
962 data_sub_sub <- subset(data_subset, group_training_class == "good_training") #(PMD_FDR_input_score==100) & (PMD_FDR_decoy==0))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
963 minimum_segment_length = 50
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
964
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
965 values <- data_sub_sub$value
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
966 n_values <- length(values)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
967 local_to_global_idx <- data_sub_sub$PMD_FDR_spectrum_index
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
968 if (n_values <= minimum_segment_length){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
969 result <- c()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
970 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
971 local_idx <- cut_values(data=values, minimum_segment_length=minimum_segment_length)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
972 result <- local_to_global_idx[local_idx]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
973 result <- remove_last(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
974 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
975 result <- c(result, max_idx)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
976 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
977 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
978 remove_last <- function(vec) {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
979 return(vec[-length(vec)])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
980 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
981
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
982 # Main code of get_breaks_all()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
983
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
984 breaks <- 1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
985
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
986 files <- unique(df_new$PMD_FDR_spectrum_file)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
987
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
988 for (local_file in files){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
989 data_subset <- subset(df_new, (PMD_FDR_spectrum_file==local_file))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
990 if (nrow(data_subset) > 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
991 breaks <- c(breaks, get_cut_points(data_subset))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
992 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
993 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
994 breaks <- sort(unique(breaks))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
995 breaks <- remove_last(breaks)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
996 breaks <- c(breaks, max(df_new$PMD_FDR_spectrum_index + 1))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
997
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
998 return(breaks)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
999 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1000
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1001 # Main code of add_group_spectrum_index()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1002
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1003 field_name_to_group <- "PMD_FDR_spectrum_index"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1004
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1005 df_new <- data_groups[order(data_groups[[field_name_to_group]]),]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1006 breaks <- get_breaks_all(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1007
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1008 df_new$group_spectrum_index <- cut(x = df_new[[field_name_to_group]], breaks = breaks, right = FALSE, dig.lab = 6)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1009 df_new <- add_group_decoy(data_groups = df_new, field_name_to_group = field_name_to_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1010
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1011 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1012 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1013 add_median_of_group_index <-function(data_groups = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1014 field_median <- "median_of_group_index"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1015 data_good <- subset(data_groups, used_to_find_middle )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1016 med <- aggregate(value~group_spectrum_index, data=data_good, FUN=safe_median)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1017 med <- rename_column(med, "value", field_median)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1018
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1019 data_groups[[field_median]] <- NULL
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1020 df_new <- merge(data_groups, med)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1021
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1022 return(df_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1023 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1024 add_1_percent_to_data_groups <- function(data_groups=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1025
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1026 data_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1027
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1028 if (get_raw_1_percent()$exists()){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1029 # Load 1 percent file
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1030 df_1_percent <- get_raw_1_percent()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1031
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1032 # Get relevant fields
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1033 df_1_percent$is_in_1percent <- TRUE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1034 df_1_percent <- rename_column(df_1_percent, "Spectrum Title", "PMD_FDR_spectrum_title")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1035 df_1_percent <- df_1_percent[,c("PMD_FDR_spectrum_title", "is_in_1percent")]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1036
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1037 # Merge with data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1038 data_new <- merge(data_new, df_1_percent, all.x=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1039 data_new$is_in_1percent[is.na(data_new$is_in_1percent)] <- FALSE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1040 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1041
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1042 # Save results
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1043 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1044
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1045 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1046
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1047
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1048 # Main code of make_data_groups()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1049 data_groups <- standardize_fields(data_original)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1050
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1051 data_groups <- add_grouped_variable(field_name_to_group = "PMD_FDR_input_score",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1052 data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1053 vec.length.out = 14,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1054 vec.tolerance = 1,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1055 value_format = "03d")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1056
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1057 data_groups <- add_grouped_variable(field_name_to_group = "PMD_FDR_pmd",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1058 data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1059 vec.length.out = 21,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1060 vec.tolerance = 0.1,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1061 value_format = "+05.1f")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1062
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1063 data_groups <- add_grouped_variable(field_name_to_group = "PMD_FDR_peptide_length",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1064 data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1065 vec.length.out = 11,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1066 vec.tolerance = 1,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1067 value_format = "02d")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1068
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1069 # data_groups <- add_grouped_variable(field_name_to_group = "m_z",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1070 # data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1071 # vec.length.out = 11,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1072 # vec.tolerance = 10,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1073 # value_format = "04.0f")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1074 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1075 # data_groups <- add_grouped_variable(field_name_to_group = "measured_mass",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1076 # data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1077 # vec.length.out = 11,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1078 # vec.tolerance = 1,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1079 # value_format = "04.0f")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1080 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1081 # data_groups <- add_already_grouped_variable(field_name_to_group = "isotope_number",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1082 # data_groups = data_groups )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1083 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1084 # data_groups <- add_already_grouped_variable(field_name_to_group = "charge",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1085 # data_groups = data_groups )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1086 #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1087 data_groups <- add_already_grouped_variable(field_name_to_group = "PMD_FDR_spectrum_file",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1088 data_groups = data_groups )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1089 data_groups <- add_protein_group(data_groups = data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1090 data_groups <- add_group_training_class( data_groups = data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1091 data_groups <- add_group_spectrum_index( data_groups = data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1092 data_groups <- add_median_of_group_index( data_groups = data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1093 data_groups <- add_value_norm( data_groups = data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1094
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1095 # fields_of_interest <- c("PMD_FDR_input_score", "PMD_FDR_pmd", "m_z", "PMD_FDR_peptide_length", "isotope_number", "charge", "PMD_FDR_spectrum_file", "measured_mass", "PMD_FDR_spectrum_index", "PMD_FDR_proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1096 # fields_of_interest <- c("value",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1097 # "PMD_FDR_decoy",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1098 # "PMD_FDR_spectrum_title",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1099 # "median_of_group_index",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1100 # "value_norm",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1101 # "used_to_find_middle",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1102 # "group_training_class",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1103 # fields_of_interest,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1104 # sprintf("group_%s" , fields_of_interest),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1105 # sprintf("group_decoy_%s", fields_of_interest))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1106
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1107 fields_of_interest <- c("PMD_FDR_input_score", "PMD_FDR_pmd", "PMD_FDR_peptide_length", "PMD_FDR_spectrum_file", "PMD_FDR_spectrum_index", "PMD_FDR_proteins")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1108 fields_of_interest <- c("value",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1109 "PMD_FDR_decoy",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1110 "PMD_FDR_spectrum_title",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1111 "median_of_group_index",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1112 "value_norm",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1113 "used_to_find_middle",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1114 "group_training_class",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1115 fields_of_interest,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1116 sprintf("group_%s" , simplify_field_name(fields_of_interest)),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1117 sprintf("group_decoy_%s", simplify_field_name(fields_of_interest)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1118
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1119 data_groups <- data_groups[,fields_of_interest]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1120 data_groups <- add_1_percent_to_data_groups(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1121
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1122 return(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1123 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1124
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1125 data_original <- get_data_converter()$df #parents[[INDEX_OF_ORIGINAL_DATA]]$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1126 df <<- make_data_groups(data_original)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1127 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1128 set_info = function(info){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1129 parents[["info"]] <<- info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1130 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1131 get_info = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1132 return(verified_element_of_list(parents, "info", "Data_Object_Groupings$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1133 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1134 set_data_converter = function(data_converter){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1135 parents[["data_converter"]] <<- data_converter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1136 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1137 get_data_converter = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1138 return(verified_element_of_list(parents, "data_converter", "Data_Object_Groupings$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1139 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1140 set_raw_1_percent = function(raw_1_percent){ ############## BUGBUG: the 1% file should be using the same file type format as the standard data (but isn't)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1141 parents[["raw_1_percent"]] <<- raw_1_percent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1142 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1143 get_raw_1_percent = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1144 return(verified_element_of_list(parents, "raw_1_percent", "Data_Object_Groupings$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1145 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1146 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1147 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1148 # Class: Data_Object_Individual_FDR
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1149 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1150 Data_Object_Individual_FDR <- setRefClass("Data_Object_Individual_FDR",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1151 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1152 fields =list(df = "data.frame"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1153 Data_Object_Individual_FDR$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1154 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1155 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1156 class_name <<- "Data_Object_Individual_FDR"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1157 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1158 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1159 data_groups = get_data_groups()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1160 densities = get_densities()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1161 alpha = get_alpha()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1162
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1163 check_field_name(data_groups, "data_groups", "value_norm")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1164 check_field_name(data_groups, "data_groups", "group_decoy_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1165 check_field_name(data_groups, "data_groups", "PMD_FDR_peptide_length")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1166 check_field_name(data_groups, "data_groups", "PMD_FDR_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1167 check_field_name(alpha, "alpha", "alpha") # BUGBUG: I'm missing a field here...
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1168 check_field_name(densities, "densities", "x")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1169 check_field_name(densities, "densities", "t")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1170 check_field_name(densities, "densities", "f")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1171
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1172 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1173 set_data_groups = function(parent){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1174 parents[["data_groups"]] <<- parent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1175 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1176 get_data_groups = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1177 return(verified_element_of_list(parents, "data_groups", "Data_Object_Individual_FDR$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1178 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1179 set_densities = function(parent){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1180 parents[["densities"]] <<- parent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1181 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1182 get_densities = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1183 return(verified_element_of_list(parents, "densities", "Data_Object_Individual_FDR$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1184 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1185 set_alpha = function(parent){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1186 parents[["alpha"]] <<- parent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1187 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1188 get_alpha = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1189 return(verified_element_of_list(parents, "alpha", "Data_Object_Individual_FDR$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1190 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1191 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1192 add_FDR_to_data_groups <- function(data_groups=NULL, densities=NULL, alpha=NULL, field_value=NULL, field_decoy_group=NULL, set_decoy_to_1=FALSE){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1193 # Support functions for add_FDR_to_data_groups()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1194 get_group_fdr <- function(group_stats = NULL, data_groups = NULL, densities=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1195 group_fdr <- apply(X = densities, MARGIN = 2, FUN = max)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1196 df_group_fdr <- data.frame(group_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1197 df_group_fdr <- rename_column(df_group_fdr, "group_fdr", "v")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1198 df_group_fdr$group_of_interest <- names(group_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1199 t <- df_group_fdr[df_group_fdr$group_of_interest == "t", "v"]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1200 f <- df_group_fdr[df_group_fdr$group_of_interest == "f", "v"]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1201 df_group_fdr <- subset(df_group_fdr, !(group_of_interest %in% c("x", "t", "f")))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1202 df_group_fdr$group_fdr <-(df_group_fdr$v - t) / (f - t)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1203
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1204 return(df_group_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1205 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1206
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1207 get_mode <- function(x){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1208 d <- density(x)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1209 return(d$x[which.max(d$y)])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1210 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1211
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1212 # Main code for add_FDR_to_data_groups()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1213
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1214 # Set up analysis
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1215 data_new <- data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1216 data_new$value_of_interest <- data_new[,field_value]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1217 data_new$group_of_interest <- data_new[,field_decoy_group]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1218
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1219 data_subset <- subset(data_new, PMD_FDR_peptide_length >= 11)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1220
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1221 # Identify mean PMD_FDR_input_score per group
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1222
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1223 group_input_score <- aggregate(PMD_FDR_input_score~group_of_interest, data=data_subset, FUN=mean)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1224 group_input_score <- rename_column(group_input_score, "PMD_FDR_input_score", "group_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1225
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1226 #group_fdr <- get_group_fdr(data_groups = data_subset, densities=densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1227 group_stats <- merge(alpha, group_input_score)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1228 group_stats <- subset(group_stats, group_of_interest != "PMD_FDR_decoy")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1229
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1230 x=c(0,group_stats$group_input_score)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1231 y=c(1,group_stats$alpha)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1232 FUN_interp <- approxfun(x=x,y=y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1233
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1234 data_new$interpolated_groupwise_FDR <- FUN_interp(data_new$PMD_FDR_input_score)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1235 if (set_decoy_to_1){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1236 data_new$interpolated_groupwise_FDR[data_new$PMD_FDR_decoy == 1] <- 1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1237 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1238
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1239 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1240 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1241
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1242 data_groups = get_data_groups()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1243 densities = get_densities()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1244 alpha = get_alpha()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1245
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1246 d_true <- densities[,c("x", "t")]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1247 d_false <- densities[,c("x", "f")]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1248
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1249 i_fdr <- add_FDR_to_data_groups(data_groups = data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1250 densities = densities,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1251 alpha = alpha,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1252 field_value ="value_norm",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1253 field_decoy_group = "group_decoy_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1254 # Derive local t
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1255 interp_t <- splinefun(x=d_true$x, y=d_true$t) #approxfun(x=d_true$x, y=d_true$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1256
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1257 # Derive local f
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1258 interp_f <- splinefun(x=d_false$x, y=d_false$f) #approxfun(x=d_true$x, y=d_true$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1259
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1260 # Derive local FDR
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1261 i_fdr$t <- interp_t(i_fdr$value_of_interest)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1262 i_fdr$f <- interp_f(i_fdr$value_of_interest)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1263 i_fdr$alpha <- i_fdr$interpolated_groupwise_FDR
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1264 i_fdr$i_fdr <- with(i_fdr, (alpha*f) / (alpha*f + (1-alpha)*t))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1265
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1266 df <<- i_fdr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1267
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1268 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1269 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1270 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1271 # Class: Data_Object_Densities
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1272 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1273 Data_Object_Densities <- setRefClass("Data_Object_Densities",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1274 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1275 fields =list(df = "data.frame"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1276 Data_Object_Densities$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1277 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1278 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1279 class_name <<- "Data_Object_Densities"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1280 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1281 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1282 df_data_groups <- get_data_groups()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1283
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1284 checkTrue(nrow(df_data_groups) > 0,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1285 msg = "data_groups data frame was empty (and should not have been)")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1286
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1287 check_field_name(df_data_groups, "data_groups", "value_norm")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1288 check_field_name(df_data_groups, "data_groups", "group_decoy_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1289 check_field_name(df_data_groups, "data_groups", "group_training_class")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1290 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1291 set_data_groups = function(parent=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1292 parents[["data_groups"]] <<- parent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1293 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1294 get_data_groups = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1295 return(verified_element_of_list(parent_list = parents, element_name = "data_groups", object_name = "Data_Object_Densities$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1296 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1297 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1298
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1299 # Support functions for make_densities()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1300 set_values_of_interest <- function(df_data_groups=NULL, field_group = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1301 field_value = "value_norm"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1302
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1303 new_data_groups <- get_data_groups()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1304 new_data_groups$value_of_interest <- new_data_groups[,field_value]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1305 new_data_groups$group_of_interest <- new_data_groups[,field_group]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1306 #groups <- sort(unique(new_data_groups$group_of_interest))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1307
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1308 return(new_data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1309 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1310 get_ylim <- function(data_groups=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1311 ylim <- range(data_groups$value_of_interest, na.rm = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1312 return(ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1313 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1314 make_hit_density <- function(data_subset=NULL, descr_of_df=NULL, ylim=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1315 #stop("Data_Object_Densities$make_hit_density() is untested beyond here")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1316 verify_density = function(data_subset=NULL, value_field=NULL, descr_of_df=NULL, ylim=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1317 values <- data_subset[value_field]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1318 values <- values[! is.na(values)]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1319 if (length(values) < MIN_ACCEPTABLE_POINTS_IN_DENSITY){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1320 stop (sprintf("There are too few valid %s (%d < %d) in %s to be used for calculating a density function",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1321 value_field,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1322 length(values),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1323 MIN_ACCEPTABLE_POINTS_IN_DENSITY,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1324 descr_of_df))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1325 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1326 d <- density(values, from = ylim[1], to = ylim[2])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1327
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1328 return(d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1329 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1330 uniformalize_density <- function(d){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1331 # Reorganizes y-values of density function so that
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1332 # function is monotone increasing to mode
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1333 # and monotone decreasing afterwards
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1334 idx_mode <- which.max(d$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1335 idx_lower <- 1:(idx_mode-1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1336 idx_upper <- idx_mode:length(d$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1337
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1338 values_lower <- d$y[idx_lower]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1339 values_upper <- d$y[idx_upper]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1340
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1341 new_d <- d
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1342 new_d$y <- c(sort(values_lower, decreasing = FALSE),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1343 sort(values_upper, decreasing = TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1344
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1345 return(new_d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1346 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1347
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1348 local_df <- subset(data_subset,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1349 (PMD_FDR_peptide_length >= MIN_GOOD_PEPTIDE_LENGTH) &
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1350 (used_to_find_middle == FALSE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1351 d <- verify_density (data_subset=local_df, value_field = "value_of_interest", descr_of_df = descr_of_df, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1352 d <- normalize_density (d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1353 d <- uniformalize_density(d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1354
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1355 return(d)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1356 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1357 make_true_hit_density <- function(data_groups=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1358 d_true <- make_hit_density(data_subset = subset(data_groups, (group_training_class == "good_testing") ),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1359 descr_of_df = "Good-testing dataset",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1360 ylim = get_ylim(data_groups))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1361 return(d_true)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1362 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1363 make_false_hit_density <- function(data_groups=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1364 d_false <- make_hit_density(data_subset = subset(data_groups, (group_training_class == "bad_long") ),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1365 descr_of_df = "Bad-long dataset",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1366 ylim = get_ylim(data_groups))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1367
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1368 return(d_false)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1369 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1370 add_v_densities <- function(data_groups=NULL, densities=NULL, field_group = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1371 groups <- sort(unique(data_groups$group_of_interest))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1372
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1373 new_densities <- densities
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1374
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1375 for (local_group in groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1376 d_v <- make_hit_density(data_subset = subset(data_groups, (group_of_interest == local_group)),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1377 descr_of_df = sprintf("subset of data (where %s is '%s')",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1378 field_group,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1379 local_group),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1380 ylim = get_ylim(data_groups))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1381 new_densities[local_group] <- d_v$y
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1382 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1383
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1384 return(new_densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1385 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1386
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1387 # Main section of make_densities()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1388 df_data_groups <- get_data_groups()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1389 new_data_groups <- set_values_of_interest(df_data_groups, field_group = "group_decoy_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1390 d_true <- make_true_hit_density( new_data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1391 d_false <- make_false_hit_density(new_data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1392
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1393 densities <- data.frame(x=d_true$x,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1394 t=d_true$y,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1395 f=d_false$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1396 densities <- add_v_densities(data_groups=new_data_groups, densities=densities, field_group = "group_decoy_input_score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1397 df <<- densities
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1398 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1399 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1400 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1401 # Class: Data_Object_Alpha
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1402 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1403 Data_Object_Alpha <- setRefClass("Data_Object_Alpha",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1404 contains = "Data_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1405 fields =list(df = "data.frame"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1406 Data_Object_Alpha$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1407 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1408 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1409 class_name <<- "Data_Object_Alpha"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1410 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1411 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1412 densities <- get_densities()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1413
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1414 checkTrue(nrow(densities) > 0,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1415 msg = "Densities data.frame was empty (and should not have been)")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1416 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1417 set_densities = function(parent=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1418 parents[["densities"]] <<- parent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1419 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1420 get_densities = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1421 return(verified_element_of_list(parent_list = parents, element_name = "densities", object_name = "Data_Object_Alpha"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1422 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1423 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1424
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1425 densities <- get_densities()$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1426
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1427 max_of_density = apply(X = densities, MARGIN = 2, FUN = max)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1428 df_alpha <- data.frame(stringsAsFactors = FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1429 list(v = max_of_density,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1430 group_of_interest = names(max_of_density)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1431 df_alpha <- subset(df_alpha, group_of_interest != "x")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1432 t <- with(subset(df_alpha, group_of_interest=="t"), v)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1433 f <- with(subset(df_alpha, group_of_interest=="f"), v)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1434 df_alpha$alpha <- with(df_alpha, (t-v)/(t-f))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1435
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1436 alpha <- df_alpha[,c("group_of_interest", "alpha")]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1437 alpha <- subset(alpha, (group_of_interest != "t") & (group_of_interest != "f"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1438
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1439 df <<- alpha
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1440 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1441 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1442 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1443 # Class: Data_Processor
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1444 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1445 Data_Processor <- setRefClass("Data_Processor",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1446 fields =list(info = "Data_Object_Info",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1447 raw_data = "Data_Object_Raw_Data",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1448 raw_1_percent = "Data_Object_Raw_1_Percent",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1449 data_converter = "Data_Object_Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1450 data_groups = "Data_Object_Groupings",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1451 densities = "Data_Object_Densities",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1452 alpha = "Data_Object_Alpha",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1453 i_fdr = "Data_Object_Individual_FDR"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1454 Data_Processor$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1455 initialize = function(p_info=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1456 if (! is.null(p_info)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1457 set_info(p_info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1458 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1459 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1460 set_info = function(p_info=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1461 # This initialization defines all of the dependencies between the various components
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1462
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1463 info <<- p_info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1464
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1465 # raw_data
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1466 raw_data$set_info(info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1467 info$append_child(raw_data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1468
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1469 # raw_1_percent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1470 raw_1_percent$set_info(info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1471 info$append_child(raw_1_percent)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1472
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1473 # data_converter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1474 data_converter$set_info (info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1475 data_converter$set_raw_data(raw_data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1476 info $append_child (data_converter)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1477 raw_data $append_child (data_converter)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1478
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1479 # data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1480 data_groups$set_info (info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1481 data_groups$set_data_converter(data_converter)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1482 data_groups$set_raw_1_percent (raw_1_percent)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1483 info $append_child (data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1484 data_converter$append_child (data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1485 raw_1_percent $append_child (data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1486
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1487 # densities
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1488 densities $set_data_groups(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1489 data_groups$append_child (densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1490
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1491 # alpha
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1492 alpha $set_densities(densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1493 densities$append_child (alpha)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1494
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1495 # i_fdr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1496 i_fdr$set_data_groups(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1497 i_fdr$set_densities (densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1498 i_fdr$set_alpha (alpha)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1499 data_groups $append_child(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1500 densities $append_child(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1501 alpha $append_child(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1502 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1503 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1504
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1505
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1506 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1507 ####### Classes for Plotting
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1508 #############################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1509
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1510 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1511 # Class: Plot_Image
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1512 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1513 Plot_Image = setRefClass("Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1514 fields = list(data_processors = "list",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1515 plot_title = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1516 include_text = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1517 include_main = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1518 x.intersp = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1519 y.intersp = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1520 scale = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1521 main = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1522 is_image_container = "logical"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1523 Plot_Image$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1524 initialize = function(p_data_processors = list(),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1525 p_include_main = TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1526 p_include_text = TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1527 p_is_image_container = FALSE){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1528 include_main <<- p_include_main
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1529 include_text <<- p_include_text
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1530 data_processors <<- p_data_processors
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1531 is_image_container <<- p_is_image_container
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1532 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1533 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1534 plot(main="Define plot_image() for subclass") # Abstract function
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1535 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1536 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1537 stop("Need to define function get_n() for subclass") #Abstract function
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1538 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1539 create_standard_main = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1540 needs_main <- function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1541 return(include_text & include_main & !is_image_container)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1542 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1543 if (needs_main()){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1544 collection_name <- data_processors[[1]]$info$collection_name()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1545 main <<- sprintf("%s\n(Dataset: %s; n=%s)", plot_title, collection_name, format(get_n(), big.mark = ","))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1546 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1547 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1548 plot_image_in_window = function(p_scale=NULL, window_height=NULL, window_width=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1549 scale <<- p_scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1550 SIZE_AXIS <- 2.5 * scale # in the units used by mar
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1551 SIZE_MAIN <- 2.5 * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1552 SIZE_NO_MARGIN <- 0.1 * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1553 FONT_SIZE <- 8 * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1554 WINDOW_WIDTH <- window_width * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1555 WINDOW_HEIGHT <- window_height * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1556 X_INTERSP <- 0.5 * scale + 0.4 # manages legend text spacing
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1557 Y_INTERSP <- 0.5 * scale + 0.4 # manages
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1558
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1559 if (include_main){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1560 mar = c(SIZE_AXIS, SIZE_AXIS, SIZE_MAIN , SIZE_NO_MARGIN)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1561 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1562 mar = c(SIZE_AXIS, SIZE_AXIS, SIZE_NO_MARGIN, SIZE_NO_MARGIN)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1563 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1564 mgp = c(SIZE_AXIS/2, SIZE_AXIS/4, 0) # Margin line (mex units) for axis title, axis labels, axis lines
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1565 ps = FONT_SIZE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1566 x.intersp <<- X_INTERSP
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1567 y.intersp <<- Y_INTERSP
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1568
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1569 windows(width = WINDOW_WIDTH, height=WINDOW_HEIGHT)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1570
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1571 old_par <- par(mar=mar, ps=ps, mgp=mgp)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1572 create_standard_main()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1573
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1574 plot_image()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1575 if (!is_image_container){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1576 axis(side=1, labels=include_text, tcl=-0.5, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1577 axis(side=2, labels=include_text, tcl=-0.5, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1578 box(lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1579 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1580 par(old_par)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1581 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1582 plot_image_in_small_window = function(p_scale=1){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1583 plot_image_in_window(p_scale=p_scale, window_height=2, window_width=3.25)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1584 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1585 plot_image_in_large_window = function(p_scale=1, window_height=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1586 plot_image_in_window(p_scale=p_scale, window_height=window_height, window_width=7)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1587 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1588 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1589 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1590 # Class: Legend_Object
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1591 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1592 Legend_Object = setRefClass("Legend_Object",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1593 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1594 fields = list(user_params = "list",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1595 scale = "numeric"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1596 Legend_Object$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1597 initialize = function(p_user_params = NULL, p_scale = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1598 if (is.null(p_user_params)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1599 user_params <<- list()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1600 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1601 user_params <<- p_user_params
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1602 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1603 if (is.null(p_scale)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1604 stop("Legend_Object must have a valid scale")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1605 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1606 scale <<- p_scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1607 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1608 user_params$x <<- if_null(user_params$x , "topleft", user_params$x)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1609 user_params$y <<- if_null(user_params$y , NULL, user_params$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1610 user_params$bty <<- if_null(user_params$bty , "o", user_params$bty)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1611 user_params$lwd <<- if_null(user_params$lwd , NULL, user_params$lwd * scale) # Because we allow NULL, scale must be inside parens
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1612 user_params$seg.len <<- if_null(user_params$seg.len , 3, user_params$seg.len ) * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1613 user_params$box.lwd <<- if_null(user_params$box.lwd , 1, user_params$box.lwd ) * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1614 user_params$x.intersp <<- if_null(user_params$x.intersp, 0.6, user_params$x.intersp) * scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1615 user_params$y.intersp <<- if_null(user_params$y.intersp, 0.4, user_params$y.intersp) * scale + 0.2
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1616 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1617 show = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1618 first_legend = legend(x = user_params$x,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1619 y = user_params$y,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1620 title = "",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1621 legend = user_params$leg,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1622 col = user_params$col,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1623 bty = user_params$bty,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1624 lty = user_params$lty,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1625 lwd = user_params$lwd,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1626 seg.len = user_params$seg.len,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1627 box.lwd = user_params$box.lwd,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1628 x.intersp = user_params$x.intersp,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1629 y.intersp = user_params$y.intersp)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1630 new_x = first_legend$rect$left
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1631 new_y = first_legend$rect$top + first_legend$rect$h * ifelse(scale==1, 0.07, 0.03 - (scale * 0.02)) #switch(scale, 0.01, -0.01, -0.03, -0.05)# (0.07 - 0.09 * ((scale-1)^2))#(0.15 - 0.08*scale)#.07 * (2 - scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1632 legend(x=new_x, y=new_y, title = user_params$title, legend = "", cex=1.15, bty="n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1633
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1634 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1635 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1636 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1637 # Class: Plot_Multiple_Images
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1638 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1639 Plot_Multiple_Images = setRefClass("Plot_Multiple_Images",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1640 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1641 fields = list(n_images_wide = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1642 n_images_tall = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1643 image_list = "list"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1644 Plot_Multiple_Images$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1645 initialize = function(p_n_images_wide=1, p_n_images_tall=2, p_image_list=NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1646 n_images_wide <<- p_n_images_wide
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1647 n_images_tall <<- p_n_images_tall
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1648 image_list <<- p_image_list
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1649 #plot_title <<- "True Hit and False Hit Distributions"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1650
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1651 callSuper(p_is_image_container=TRUE, ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1652 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1653 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1654 # Support functions
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1655 apply_mtext <- function(letter=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1656 line=1.3*scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1657 mtext(letter, side=1, line=line, adj=0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1658 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1659 # main code
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1660 old_par <- par(mfrow=c(n_images_tall, n_images_wide))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1661 i=0
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1662 n_images <- length(image_list)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1663
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1664 for (i in 1:n_images){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1665 image <- image_list[[i]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1666 image$create_standard_main()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1667 image$scale <- scale
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1668 image$plot_image()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1669 axis(side=1, labels=include_text, tcl=-0.5, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1670 axis(side=2, labels=include_text, tcl=-0.5, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1671 box(lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1672 apply_mtext(letter=sprintf("(%s)", letters[i]))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1673
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1674 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1675 par(old_par)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1676
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1677 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1678 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1679 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1680 # Class: Plot_Compare_PMD_and_Norm_Density
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1681 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1682 Plot_Compare_PMD_and_Norm_Density = setRefClass("Plot_Compare_PMD_and_Norm_Density",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1683 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1684 fields = list(show_norm = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1685 display_n_psms = "logical"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1686 Plot_Compare_PMD_and_Norm_Density$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1687 initialize = function(p_show_norm=TRUE, p_display_n_psms=TRUE, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1688 show_norm <<- p_show_norm
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1689 display_n_psms <<- p_display_n_psms
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1690 plot_title <<- "True Hit and False Hit Distributions"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1691
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1692 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1693 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1694 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1695 # Support functions for plot_compare_PMD_and_norm_density()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1696
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1697 get_densities <- function(data_subset = NULL, var_value = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1698 data_subset$value_of_interest <- data_subset[,var_value]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1699 from <- min(data_subset$value_of_interest, na.rm = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1700 to <- max(data_subset$value_of_interest, na.rm = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1701 xlim = range(data_subset$value_of_interest)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1702 data_true <- subset(data_subset, (PMD_FDR_decoy==0) & (PMD_FDR_input_score==100))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1703 data_false <- subset(data_subset, (PMD_FDR_decoy==1))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1704
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1705 d_true <- with(data_true , density(value_of_interest, from = from, to = to, na.rm = TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1706 d_false <- with(data_false, density(value_of_interest, from = from, to = to, na.rm = TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1707 d_true <- normalize_density(d_true)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1708 d_false <- normalize_density(d_false)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1709
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1710 densities <- list(d_true=d_true, d_false=d_false, var_value = var_value, n_true = nrow(data_true), n_false = nrow(data_false))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1711
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1712 return(densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1713 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1714 get_xlim <- function(densities_a = NULL, densities_b = NULL, show_norm=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1715 xlim <- range(c( densities_a$d_true$x, densities_a$d_false$y))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1716 if (show_norm){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1717 xlim <- range(c(xlim, densities_b$d_true$x, densities_b$d_false$y))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1718 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1719 return(xlim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1720 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1721 get_ylim <- function(densities_a = NULL, densities_b = NULL, show_norm=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1722 ylim <- range(c( densities_a$d_true$y, densities_a$d_false$y))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1723 if (show_norm){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1724 ylim <- range(c(ylim, densities_b$d_true$y, densities_b$d_false$y))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1725 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1726 return(ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1727 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1728 plot_distributions <- function(densities = NULL, var_value= NULL, dataset_name = NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1729 leg = list()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1730 leg$leg = c("Good", "Bad")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1731 if (display_n_psms){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1732 leg$leg = sprintf("%s (%d PSMs)",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1733 leg$leg,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1734 c(densities$n_true, densities$n_false))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1735
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1736 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1737 leg$col = c("black", "red")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1738 leg$lwd = c(3 , 3)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1739 leg$lty = c(1 , 2)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1740 leg$title = "Hit Category"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1741 xlab = ifelse(var_value == "value",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1742 "PMD (ppm)",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1743 "PMD - normalized (ppm)")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1744 ylab = "Density"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1745 if (!include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1746 xlab = ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1747 ylab = ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1748 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1749 plot( densities$d_true , col=leg$col[1], lwd=leg$lwd[1] * scale, lty=leg$lty[1], xaxt = "n", yaxt = "n", main=main, xlab = xlab, ylab=ylab, ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1750 lines(densities$d_false, col=leg$col[2], lwd=leg$lwd[2] * scale, lty=leg$lty[2])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1751 abline(v=0, h=0, col="gray", lwd=1*scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1752 if (include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1753 legend_object <- Legend_Object$new(leg, scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1754 legend_object$show()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1755 #legend("topleft", legend=leg.leg, col=leg.col, lwd=leg.lwd, lty=leg.lty, x.intersp = x.intersp, y.intersp = y.intersp)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1756 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1757 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1758
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1759 # Main code block for plot_compare_PMD_and_norm_density
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1760 data_processor <- data_processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1761 data_processor$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1762 data_groups <- data_processor$data_groups$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1763
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1764 data_subset_a <- subset(data_groups , used_to_find_middle == FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1765 data_subset_b <- subset(data_subset_a, PMD_FDR_peptide_length > 11)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1766
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1767 densities_a <- get_densities(data_subset = data_subset_a, var_value = "value")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1768 densities_b <- get_densities(data_subset = data_subset_b, var_value = "value_norm")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1769
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1770 xlim=get_xlim(densities_a, densities_b, show_norm = show_norm)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1771 ylim=get_ylim(densities_a, densities_b, show_norm = show_norm)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1772
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1773 dataset_name <- data_processor$info$collection_name
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1774 plot_distributions( densities=densities_a, var_value = "value" , dataset_name = dataset_name, xlim=xlim, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1775 if (show_norm){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1776 plot_distributions(densities=densities_b, var_value = "value_norm", dataset_name = dataset_name, xlim=xlim, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1777 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1778 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1779 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1780 data_processor <- data_processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1781 data_processor$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1782 data_subset_a <- subset(data_processor$data_groups$df , used_to_find_middle == FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1783 data_subset_b <- subset(data_subset_a, PMD_FDR_peptide_length > 11)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1784
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1785 if (show_norm){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1786 data_subset <- data_subset_a
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1787 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1788 data_subset <- data_subset_b
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1789 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1790
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1791 data_true <- subset(data_subset, (PMD_FDR_decoy==0) & (PMD_FDR_input_score==100))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1792 data_false <- subset(data_subset, (PMD_FDR_decoy==1))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1793
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1794 return(nrow(data_true) + nrow(data_false))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1795 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1796 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1797
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1798 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1799 # Class: Plot_Time_Invariance_Alt
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1800 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1801 Plot_Time_Invariance_Alt = setRefClass("Plot_Time_Invariance_Alt",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1802 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1803 fields = list(show_norm = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1804 display_n_psms = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1805 training_class = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1806 ylim = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1807 field_of_interest = "character"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1808 Plot_Time_Invariance_Alt$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1809 initialize = function(p_ylim=NULL, p_training_class=NULL, p_field_of_interest="value_norm", ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1810 get_subset_title <- function(training_class=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1811 if (training_class == "bad_long"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1812 subset_title="bad only"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1813 } else if (training_class == "good_testing"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1814 subset_title="good-testing only"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1815 } else if (training_class == "good_training"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1816 subset_title="good-training only"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1817 } else if (training_class == "other"){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1818 subset_title="other only"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1819 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1820 stop("Unexpected training_class in plot_time_invariance")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1821 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1822 return(subset_title)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1823 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1824
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1825 ylim <<- p_ylim
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1826 training_class <<- p_training_class
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1827 field_of_interest <<- p_field_of_interest
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1828 subset_title <- get_subset_title(training_class=training_class)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1829 backup_title <- sprintf("Middle 25%% PMD for spectra sorted by index%s",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1830 ifelse(is.null(subset_title),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1831 "",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1832 sprintf(" - %s", subset_title)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1833 #plot_title <<- get_main(main_title=main, backup_title=backup_title, data_collection = data_collection)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1834 plot_title <<- backup_title
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1835
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1836 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1837 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1838 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1839 # Support functions for plot_time_invariance()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1840
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1841 # Main code of plot_time_invariance()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1842 data_subset = get_data_subset()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1843 plot_group_spectrum_index_from_subset_boxes(data_subset = data_subset)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1844 abline(h=0, col="blue", lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1845 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1846 get_data_subset = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1847 data_processor <- data_processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1848 data_processor$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1849 return(subset(data_processor$data_groups$df, (group_training_class==training_class)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1850 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1851 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1852 return(nrow(get_data_subset()))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1853 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1854 plot_group_spectrum_index_from_subset_boxes = function(data_subset = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1855 n_plot_groups <- 100
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1856
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1857 field_name_text <- ifelse(field_of_interest=="value", "PMD", "Translated PMD")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1858 new_subset <- data_subset
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1859 new_subset$value_of_interest <- new_subset[,field_of_interest]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1860 new_subset <- new_subset[order(new_subset$PMD_FDR_spectrum_index),]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1861
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1862 idxs <- round_to_tolerance(seq(from=1, to=nrow(new_subset), length.out = n_plot_groups+1), 1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1863 idxs_left <- idxs[-(n_plot_groups+1)]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1864 idxs_right <- idxs[-1] - 1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1865 idxs_right[n_plot_groups] <- idxs_right[n_plot_groups] + 1
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1866
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1867 new_subset$plot_group <- NA
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1868 for (i in 1:n_plot_groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1869 new_subset$plot_group[idxs_left[i]:idxs_right[i]] <- i
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1870 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1871 xleft <- aggregate(PMD_FDR_spectrum_index ~plot_group, data=new_subset, FUN=min)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1872 xright <- aggregate(PMD_FDR_spectrum_index ~plot_group, data=new_subset, FUN=max)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1873 ybottom <- aggregate(value_of_interest~plot_group, data=new_subset, FUN=function(x){quantile(x, probs = 0.5 - (0.25/2))})
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1874 ytop <- aggregate(value_of_interest~plot_group, data=new_subset, FUN=function(x){quantile(x, probs = 0.5 + (0.25/2))})
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1875 boxes <- merge( rename_column(xleft , "PMD_FDR_spectrum_index" , "xleft"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1876 merge( rename_column(xright , "PMD_FDR_spectrum_index" , "xright"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1877 merge(rename_column(ybottom, "value_of_interest", "ybottom"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1878 rename_column(ytop , "value_of_interest", "ytop"))))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1879
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1880 xlab <- "Spectrum Index"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1881 ylab <- sprintf("%s (ppm)", field_name_text )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1882 if (is.null(ylim)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1883 ylim <<- range(new_subset$value_of_interest)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1884 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1885 if (!include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1886 xlab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1887 ylab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1888 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1889 plot(value_of_interest~PMD_FDR_spectrum_index, data=new_subset, type="n", ylim=ylim, xlab = xlab, ylab=ylab, main=main, xaxt="n", yaxt="n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1890 with(boxes, rect(xleft = xleft, ybottom = ybottom, xright = xright, ytop = ytop, lwd=scale))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1891 #points(median_of_group_index~PMD_FDR_spectrum_index, data=data_subset, cex=.5, pch=15)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1892 axis(1, labels=include_text, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1893 axis(2, labels=include_text, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1894 box(lwd=scale) #box around plot area
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1895 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1896
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1897 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1898 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1899 # Class: Plot_Time_Invariance_Alt_Before_and_After
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1900 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1901 Plot_Time_Invariance_Alt_Before_and_After = setRefClass("Plot_Time_Invariance_Alt_Before_and_After",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1902 contains = "Plot_Multiple_Images",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1903 fields = list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1904 Plot_Time_Invariance_Alt_Before_and_After$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1905 initialize = function(p_data_processors = NULL,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1906 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1907 p_include_main=FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1908 p_ylim = c(-4,4), ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1909 plot_object1 <- Plot_Time_Invariance_Alt$new(p_data_processors = p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1910 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1911 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1912 p_training_class = "good_testing",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1913 p_field_of_interest = "value",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1914 p_ylim = p_ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1915
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1916 plot_object2 <- Plot_Time_Invariance_Alt$new(p_data_processors = p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1917 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1918 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1919 p_training_class = "good_testing",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1920 p_field_of_interest = "value_norm",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1921 p_ylim = p_ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1922
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1923 callSuper(p_n_images_wide=1,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1924 p_n_images_tall=2,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1925 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1926 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1927 p_image_list = list(plot_object1, plot_object2), ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1928 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1929 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1930
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1931 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1932 # Class: Plot_Density_PMD_and_Norm_Decoy_by_AA_Length
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1933 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1934 Plot_Density_PMD_and_Norm_Decoy_by_AA_Length = setRefClass("Plot_Density_PMD_and_Norm_Decoy_by_AA_Length",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1935 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1936 fields = list(show_norm = "logical"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1937 Plot_Density_PMD_and_Norm_Decoy_by_AA_Length$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1938 initialize = function(p_show_norm=FALSE, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1939 plot_title <<- "The Decoy Bump: PMD Distribution of Decoy matches by peptide length"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1940 show_norm <<- p_show_norm
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1941 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1942 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1943 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1944 data_processor <- data_processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1945 data_processor$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1946 data_subset <- subset(data_processor$data_groups$df, (PMD_FDR_decoy == 1))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1947 return(nrow(data_subset))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1948 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1949 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1950
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1951 # Support functions for plot_density_PMD_and_norm_decoy_by_aa_length()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1952
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1953 add_group_peptide_length_special <- function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1954 data_processor <- data_processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1955 data_processor$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1956 data_groups <- data_processor$data_groups$df # the name data_groups is a data.frame instead of a Data_Object
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1957 data_groups <- subset(data_groups, used_to_find_middle == FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1958
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1959 df_group_definition <- data.frame(stringsAsFactors = FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1960 list(group_peptide_length_special = c("06-08", "09-10", "11-12", "13-15", "16-20", "21-50"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1961 min = c( 6 , 9 , 11 , 13 , 16 , 21 ),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1962 max = c( 8 , 10 , 12 , 15 , 20 , 50 ) ))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1963 group_peptide_length_special <- data.frame(list(PMD_FDR_peptide_length = 6:50))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1964 group_peptide_length_special$min <- with(group_peptide_length_special, sapply(PMD_FDR_peptide_length, FUN = function(i) max(df_group_definition$min[df_group_definition$min <= i])))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1965 group_peptide_length_special <- merge(group_peptide_length_special, df_group_definition)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1966
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1967 data_groups$group_peptide_length_special <- NULL
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1968 new_data_groups <- (merge(data_groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1969 group_peptide_length_special[,c("PMD_FDR_peptide_length",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1970 "group_peptide_length_special")]))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1971 return(new_data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1972 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1973 get_densities <- function(data_subset = NULL, field_value = NULL, field_group=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1974 get_density_from_subset <- function(data_subset=NULL, xlim=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1975
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1976 d_group <- with(data_subset , density(value_of_interest, from = xlim[1], to = xlim[2], na.rm=TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1977 d_group <- normalize_density(d_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1978
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1979 return(d_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1980 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1981
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1982 data_temp <- data_subset
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1983 data_temp$value_of_interest <- data_temp[[field_value]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1984 data_temp$group_of_interest <- data_temp[[field_group]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1985
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1986 xlim = range(data_temp$value_of_interest, na.rm=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1987
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1988 groups <- sort(unique(data_temp$group_of_interest))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1989 n_groups <- length(groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1990
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1991 d_group <- get_density_from_subset( data_subset=data_temp, xlim = xlim )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1992 densities <- list("All decoys" = d_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1993 for (i in 1:n_groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1994 group <- groups[i]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1995
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1996 d_group <- get_density_from_subset( data_subset=subset(data_temp, (group_of_interest == group)),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1997 xlim = xlim )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1998 densities[[group]] <- d_group
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
1999 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2000
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2001 return(densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2002 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2003 get_limits <- function(densities_a = NULL, densities_b = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2004 xlim = c()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2005 ylim = c(0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2006 for (single_density in densities_a){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2007 xlim=range(c(xlim, single_density$x))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2008 ylim=range(c(ylim, single_density$y))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2009 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2010 for (single_density in densities_b){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2011 xlim=range(c(xlim, single_density$x))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2012 ylim=range(c(ylim, single_density$y))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2013 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2014
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2015 return(list(xlim=xlim, ylim=ylim))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2016 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2017 plot_distributions <- function(data_groups = NULL, xlim=NULL, ylim=NULL, densities = NULL, field_group= NULL, field_value = "value", xlab_modifier = "", var_value= NULL, include_peak_dots=TRUE, dataset_name = NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2018 data_groups$group_of_interest <- data_groups[[field_group]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2019 data_groups$value_of_interest <- data_groups[[field_value]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2020
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2021 # Main body of plot_decoy_distribution_by_field_of_interest()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2022 FIXED_LWD=3
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2023
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2024 groups <- sort(unique(data_groups$group_of_interest))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2025 n <- length(groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2026
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2027 df_leg <- data.frame(stringsAsFactors = FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2028 list(leg = groups,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2029 col = rainbow_with_fixed_intensity(n = n, goal_intensity_0_1 = 0.4),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2030 lty = rep(1:6, length.out=n),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2031 lwd = rep(FIXED_LWD , n)) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2032
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2033 d <- densities[["All decoys"]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2034
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2035 xlab = sprintf("Precursor Mass Discrepancy%s (ppm)", xlab_modifier)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2036 ylab = "Density"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2037
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2038 if (!include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2039 xlab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2040 ylab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2041 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2042 plot(d, lwd=FIXED_LWD * scale, main=main, xlab=xlab, ylab=ylab, xlim=xlim, ylim=ylim, xaxt="n", yaxt="n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2043
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2044 ave_peak <- max(d$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2045 max_peak <- 0
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2046
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2047 for (local_group in groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2048 data_subset <- subset(data_groups, group_of_interest == local_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2049 data_info <- subset(df_leg , leg == local_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2050 col <- data_info$col[1]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2051 lty <- data_info$lty[1]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2052 lwd <- data_info$lwd[1]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2053 if (nrow(data_subset) > 100){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2054 d <- densities[[local_group]] #density(data_subset[[field_value]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2055 lines(d, col=col, lty=lty, lwd=lwd * scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2056 peak <- max(d$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2057 max_peak <- max(max_peak, peak)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2058 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2059 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2060 abline(v=0, h=0, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2061 leg <- list(title = "Peptide length (aa)",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2062 leg = c("All decoys" , df_leg$leg),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2063 col = c(col2hex("black") , df_leg$col),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2064 lty = c(1 , df_leg$lty),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2065 lwd = c(FIXED_LWD , df_leg$lwd)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2066 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2067 if (include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2068 legend_object = Legend_Object$new(leg, scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2069 legend_object$show()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2070 #first_legend = legend(x="topleft", title = "", legend = leg$leg, col = leg$col, lty = leg$lty, lwd = leg$lwd, seg.len=leg$seg.len, box.lwd=leg$box.lwd, x.intersp = leg$x.intersp, y.intersp = leg$y.intersp)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2071 #new_x = first_legend$rect$left
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2072 #new_y = first_legend$rect$top + first_legend$rect$h * .07 * (2 - scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2073 #legend(x=new_x, y=new_y, title = leg$title, legend = "", cex=1.15, bty="n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2074 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2075
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2076 box(lwd=scale) #box around plot area
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2077
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2078 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2079
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2080 # Main body for plot_density_PMD_and_norm_decoy_by_aa_length()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2081
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2082 data_mod <- add_group_peptide_length_special()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2083 data_mod <- subset(data_mod, PMD_FDR_decoy==1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2084
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2085 densities_a <- get_densities(data_subset = data_mod, field_value = "value" , field_group = "group_peptide_length_special")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2086 densities_b <- get_densities(data_subset = data_mod, field_value = "value_norm", field_group = "group_peptide_length_special")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2087
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2088 data_processor <- data_processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2089 dataset_name <- data_processor$info$collection_name()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2090
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2091 limits <- get_limits(densities_a, densities_b)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2092 xlim <- limits$xlim
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2093 ylim <- limits$ylim
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2094
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2095 if (show_norm){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2096 plot_distributions(data_groups = data_mod, densities=densities_b, field_value = "value_norm", xlab_modifier = " - normalized", field_group = "group_peptide_length_special", dataset_name=dataset_name, xlim=xlim, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2097 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2098 plot_distributions(data_groups = data_mod, densities=densities_a, field_value = "value" , xlab_modifier = "" , field_group = "group_peptide_length_special", dataset_name=dataset_name, xlim=xlim, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2099 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2100 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2101
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2102 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2103
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2104 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2105 # Class: Plot_Bad_CI
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2106 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2107 Plot_Bad_CI = setRefClass("Plot_Bad_CI",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2108 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2109 fields = list(breaks = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2110 ylim = "numeric"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2111 Plot_Bad_CI$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2112 initialize = function(p_breaks=20, p_ylim=NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2113 if (is.null(p_ylim)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2114 ylim <<- numeric(0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2115 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2116 ylim <<- p_ylim
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2117 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2118 breaks <<- p_breaks
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2119 plot_title <<- "Credible Intervals for proportion within range - bad"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2120 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2121 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2122 data_processor = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2123 return(data_processors[[1]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2124 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2125 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2126 data_processor()$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2127 return(nrow(subset(data_processor()$data_groups$df, (PMD_FDR_decoy == 1))))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2128 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2129 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2130 data_processor()$data_groups$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2131 data_groups <- data_processor()$data_groups$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2132 data_decoy <- subset(data_groups, data_groups$group_training_class == "bad_long")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2133 data_decoy$region <- cut(x = data_decoy$value, breaks = breaks)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2134 table(data_decoy$region)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2135 regions <- unique(data_decoy$region)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2136
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2137 N = nrow(data_decoy)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2138 find_lower_ci_bound <- function(x){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2139 ci <- credible_interval(length(x), N, precision = 0.001, alpha=0.05)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2140 return(ci[1])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2141 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2142 find_upper_ci_bound <- function(x){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2143 ci <- credible_interval(length(x), N, precision = 0.001, alpha=0.05)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2144 return(ci[2])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2145 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2146 xleft <- aggregate(value~region, data=data_decoy, FUN=min)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2147 xright <- aggregate(value~region, data=data_decoy, FUN=max)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2148 ytop <- aggregate(value~region, data=data_decoy, FUN=find_upper_ci_bound)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2149 ybottom <- aggregate(value~region, data=data_decoy, FUN=find_lower_ci_bound)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2150
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2151 xleft <- rename_column(xleft , "value", "xleft" )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2152 xright <- rename_column(xright , "value", "xright" )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2153 ytop <- rename_column(ytop , "value", "ytop" )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2154 ybottom <- rename_column(ybottom, "value", "ybottom")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2155
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2156 boxes <- merge(merge(xleft, xright), merge(ytop, ybottom))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2157
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2158
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2159 xlab <- "Precursor Mass Discrepancy (ppm)"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2160 ylab <- "Proportion of PSMs\nin subgroup"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2161 xlim=range(data_decoy$value, na.rm = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2162 get_ylim(boxes=boxes)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2163 if (!include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2164 xlab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2165 ylab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2166 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2167
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2168 plot(x=c(-10,10), y=c(0,1), type="n", ylim=ylim, xlim=xlim, xlab=xlab, ylab=ylab, main=main, xaxt="n", yaxt="n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2169
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2170 with(boxes, rect(xleft=xleft, xright=xright, ytop=ytop, ybottom=ybottom, lwd=scale))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2171
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2172 abline(h=1/breaks, col="blue", lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2173 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2174 get_ylim = function(boxes=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2175 is_valid_range <- function(r=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2176 return(length(r) == 2)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2177 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2178 if (! is_valid_range(ylim)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2179 ylim <<- range(c(0,boxes$ytop, boxes$ybottom))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2180 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2181 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2182
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2183 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2184 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2185 # Class: Plot_Selective_Loss
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2186 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2187 Plot_Selective_Loss = setRefClass("Plot_Selective_Loss",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2188 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2189 fields = list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2190 Plot_Selective_Loss$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2191 initialize = function( ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2192 plot_title <<- "PMD-FDR Selectively removes Bad Hits"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2193 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2194 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2195 data_processor = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2196 return(data_processors[[1]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2197 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2198 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2199 data_processor()$i_fdr$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2200 data_subset <- data_processor()$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2201 return(nrow(data_subset))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2202 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2203 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2204 # Support functions for plot_selective_loss()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2205
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2206 samples_lost_by_threshold <- function(updated_i_fdr=NULL, score_threshold=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2207 data_subset <- subset(updated_i_fdr, PMD_FDR_input_score >= score_threshold)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2208 tbl <- with(updated_i_fdr,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2209 table(PMD_FDR_input_score >= score_threshold,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2210 new_confidence < score_threshold,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2211 group_decoy_proteins))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2212 df <- data.frame(tbl)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2213 df_n <- aggregate(Freq~group_decoy_proteins+Var1, data=df, FUN=sum)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2214 df_n <- rename_column(df_n, name_before = "Freq", "n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2215 df <- merge(df, df_n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2216 df$rate_of_loss <- with(df, Freq/n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2217 df <- subset(df, (Var1==TRUE) & (Var2==TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2218 df <- df[,c("group_decoy_proteins", "rate_of_loss", "n", "Freq")]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2219 if (nrow(df) > 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2220 df$score_threshold <- score_threshold
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2221 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2222 return(df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2223 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2224 get_loss_record <- function(updated_i_fdr=NULL, score_thresholds=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2225 df=data.frame()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2226 for (score_threshold in score_thresholds){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2227 df_new_loss <- samples_lost_by_threshold(updated_i_fdr, score_threshold)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2228 df <- rbind(df, df_new_loss)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2229 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2230 return(df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2231 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2232
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2233 # Main code for plot_selective_loss()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2234
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2235 updated_i_fdr <- data_processor()$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2236 updated_i_fdr$new_confidence <- with(updated_i_fdr, 100 * (1-i_fdr)) #ifelse((1-i_fdr) < (PMD_FDR_input_score / 100), (1-i_fdr), (PMD_FDR_input_score/100)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2237 loss_record <- get_loss_record(updated_i_fdr=updated_i_fdr, score_thresholds = 1:100)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2238 xlim <- with(loss_record, range(score_threshold))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2239 ylim <- c(0,1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2240 xlab <- "Fixed Confidence threshold (PeptideShaker score)"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2241 ylab <- "Rate of PSM disqualification from PMD-FDR"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2242 lwd <- 4
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2243 plot(x=xlim, y=ylim, type="n", main=main, xlab=xlab, ylab=ylab)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2244
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2245 groups <- sort(unique(loss_record$group_decoy_proteins))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2246 n_g <- length(groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2247
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2248 cols <- rainbow_with_fixed_intensity(n=n_g, goal_intensity_0_1 = 0.5, alpha = 1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2249 ltys <- rep(1:6, length.out=n_g)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2250
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2251 leg <- list(leg=groups, col=cols, lty=ltys, lwd=lwd, title="Species/Category")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2252
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2253 for (i in 1:n_g){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2254 lines(rate_of_loss~score_threshold, data=subset(loss_record, group_decoy_proteins==leg$leg[i]), col=leg$col[i], lwd=leg$lwd * scale, lty=leg$lty[i])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2255 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2256 abline(h=0, v=100, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2257 abline(h=c(0.1, 0.8), col="gray", lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2258
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2259 #leg = list(leg=group, col=col, lty=lty, lwd=lwd)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2260 #with(leg, legend(x = "topleft", legend = group, col = col, lty = lty, lwd = lwd, seg.len = seg.len))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2261 legend_object <- Legend_Object$new(leg, scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2262 legend_object$show()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2263 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2264
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2265 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2266 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2267 # Class: Plot_Selective_Loss_for_TOC
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2268 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2269 Plot_Selective_Loss_for_TOC = setRefClass("Plot_Selective_Loss_for_TOC",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2270 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2271 fields = list(xlab="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2272 ylab="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2273 title_x="numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2274 title_y="numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2275 legend_border="logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2276 legend_x = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2277 legend_y = "numeric",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2278 legend_title="character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2279 legend_location = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2280 name_contaminant = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2281 name_decoy = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2282 name_human = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2283 name_pyro = "character"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2284 Plot_Selective_Loss_for_TOC$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2285 initialize = function( ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2286 plot_title <<- "PMD-FDR selectively removes bad hits"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2287 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2288 xlab <<- "Confidence threshold (PeptideShaker)"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2289 ylab <<- "PMD Disqualifiction Rate"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2290 legend_border <<- FALSE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2291 #legend_title <<- "Species/Category"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2292 title_x <<- 50
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2293 title_y <<- 0.9
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2294 legend_x <<- 10
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2295 legend_y <<- 0.75
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2296 name_contaminant <<- "signal - contaminant"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2297 name_decoy <<- "decoy - reversed"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2298 name_human <<- "decoy - human"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2299 name_pyro <<- "signal - pyrococcus"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2300 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2301 data_processor = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2302 return(data_processors[[1]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2303 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2304 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2305 data_processor()$i_fdr$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2306 data_subset <- data_processor()$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2307 return(nrow(data_subset))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2308 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2309 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2310 # Support functions for plot_selective_loss()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2311
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2312 samples_lost_by_threshold <- function(updated_i_fdr=NULL, score_threshold=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2313 data_subset <- subset(updated_i_fdr, PMD_FDR_input_score >= score_threshold)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2314 tbl <- with(updated_i_fdr,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2315 table(PMD_FDR_input_score >= score_threshold,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2316 new_confidence < score_threshold,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2317 group_decoy_proteins))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2318 df <- data.frame(tbl)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2319 df_n <- aggregate(Freq~group_decoy_proteins+Var1, data=df, FUN=sum)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2320 df_n <- rename_column(df_n, name_before = "Freq", "n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2321 df <- merge(df, df_n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2322 df$rate_of_loss <- with(df, Freq/n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2323 df <- subset(df, (Var1==TRUE) & (Var2==TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2324 df <- df[,c("group_decoy_proteins", "rate_of_loss", "n", "Freq")]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2325 if (nrow(df) > 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2326 df$score_threshold <- score_threshold
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2327 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2328 return(df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2329 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2330 get_loss_record <- function(updated_i_fdr=NULL, score_thresholds=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2331 df=data.frame()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2332 for (score_threshold in score_thresholds){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2333 df_new_loss <- samples_lost_by_threshold(updated_i_fdr, score_threshold)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2334 df <- rbind(df, df_new_loss)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2335 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2336 return(df)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2337 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2338 convert_groups <- function(groups=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2339 new_groups <- groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2340 new_groups <- gsub(pattern = "contaminant", replacement = name_contaminant, x = new_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2341 new_groups <- gsub(pattern = "decoy" , replacement = name_decoy , x = new_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2342 new_groups <- gsub(pattern = "human" , replacement = name_human , x = new_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2343 new_groups <- gsub(pattern = "pyrococcus" , replacement = name_pyro , x = new_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2344
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2345 return(new_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2346 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2347
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2348 # Main code for plot_selective_loss()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2349
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2350 updated_i_fdr <- data_processor()$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2351 updated_i_fdr$new_confidence <- with(updated_i_fdr, 100 * (1-i_fdr)) #ifelse((1-i_fdr) < (PMD_FDR_input_score / 100), (1-i_fdr), (PMD_FDR_input_score/100)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2352 loss_record <- get_loss_record(updated_i_fdr=updated_i_fdr, score_thresholds = 1:100)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2353 xlim <- with(loss_record, range(score_threshold))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2354 ylim <- c(0,1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2355 #xlab <- "Fixed Confidence threshold (PeptideShaker score)"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2356 #ylab <- "Rate of PSM disqualification from PMD-FDR"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2357 lwd <- 4
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2358 plot(x=xlim, y=ylim, type="n", main=main, xlab=xlab, ylab=ylab)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2359
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2360 groups <- sort(unique(loss_record$group_decoy_proteins))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2361 n_g <- length(groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2362
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2363 cols <- rainbow_with_fixed_intensity(n=n_g, goal_intensity_0_1 = 0.5, alpha = 1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2364 ltys <- rep(1:6, length.out=n_g)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2365 bty <- ifelse(legend_border, "o", "n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2366
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2367 leg <- list(leg=convert_groups(groups), var_name=groups, col=cols, lty=ltys, lwd=lwd, bty=bty, x=legend_x, y=legend_y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2368 #leg <- list(leg=groups, col=cols, lty=ltys, lwd=lwd, bty=bty, x=legend_x, y=legend_y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2369
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2370 for (i in 1:n_g){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2371 lines(rate_of_loss~score_threshold, data=subset(loss_record, group_decoy_proteins==leg$var_name[i]), col=leg$col[i], lwd=leg$lwd * scale, lty=leg$lty[i])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2372 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2373 abline(h=0, v=100, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2374 abline(h=c(0.1, 0.8), col="gray", lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2375
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2376 #leg = list(leg=group, col=col, lty=lty, lwd=lwd)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2377 #with(leg, legend(x = "topleft", legend = group, col = col, lty = lty, lwd = lwd, seg.len = seg.len))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2378 legend_object <- Legend_Object$new(leg, scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2379 legend_object$show()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2380 text(x=title_x, y=title_y, labels = plot_title)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2381 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2382
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2383 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2384 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2385 # Class: Plot_Compare_iFDR_Confidence_1_Percent_TD_FDR
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2386 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2387 Plot_Compare_iFDR_Confidence_1_Percent_TD_FDR = setRefClass("Plot_Compare_iFDR_Confidence_1_Percent_TD_FDR",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2388 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2389 fields = list())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2390 Plot_Compare_iFDR_Confidence_1_Percent_TD_FDR$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2391 initialize = function( ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2392 plot_title <<- "Precursor Mass Discrepance i-FDR for 1% Target-Decoy FDR PSMs"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2393 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2394 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2395 data_processor = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2396 return(data_processors[[1]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2397 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2398 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2399 data_processor()$i_fdr$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2400 if (one_percent_calculation_exists()){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2401 i_fdr <- data_processor()$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2402 data_subset <- subset(i_fdr, is_in_1percent==TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2403 n <- nrow(data_subset)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2404 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2405 n <- 0
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2406 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2407
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2408 return (n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2409 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2410 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2411 if (one_percent_calculation_exists()){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2412 i_fdr <- get_modified_fdr()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2413 report_good_discrepancies(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2414 data_TD_good <- get_data_TD_good(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2415 mean_results <- get_mean_results(data_TD_good)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2416 boxes <- mean_results
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2417 boxes <- rename_columns(df = boxes,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2418 names_before = c("min_conf", "max_conf", "lower" , "upper"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2419 names_after = c("xleft" , "xright" , "ybottom", "ytop" ))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2420 xlim <- range(boxes[,c("xleft", "xright")])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2421 ylim <- range(boxes[,c("ybottom", "ytop")])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2422
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2423 #head(mean_results)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2424
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2425 xlab = "Confidence Score (Peptide Shaker)"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2426 ylab = "Mean PMD i-FDR"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2427
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2428 if (!include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2429 xlab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2430 ylab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2431 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2432
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2433 plot(mean_i_fdr~mean_conf, data=mean_results, xlim=xlim, ylim=ylim, xlab=xlab, ylab=ylab, main=main, xaxt="n", yaxt="n", cex=scale, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2434 with(boxes, rect(xleft = xleft, ybottom = ybottom, xright = xright, ytop = ytop, lwd=scale))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2435 abline(b=-1, a=100, lwd=4*scale, col="dark gray")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2436 abline(h=0, v=100, lwd=1*scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2437
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2438 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2439 stop(sprintf("Dataset '%s' does not include 1%% FDR data", data_processor()$info$collection_name()))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2440 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2441 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2442 get_mean_results = function(data_TD_good = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2443 mean_i_fdr <- aggregate(i_fdr~conf_group, data=data_TD_good, FUN=mean)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2444 mean_i_fdr <- rename_column(mean_i_fdr, "i_fdr", "mean_i_fdr")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2445 sd_i_fdr <- aggregate(i_fdr~conf_group, data=data_TD_good, FUN=sd)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2446 sd_i_fdr <- rename_column(sd_i_fdr, "i_fdr", "sd_i_fdr")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2447 n_i_fdr <- aggregate(i_fdr~conf_group, data=data_TD_good, FUN=length)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2448 n_i_fdr <- rename_column(n_i_fdr, "i_fdr", "n")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2449 mean_conf <- aggregate(PMD_FDR_input_score~conf_group, data=data_TD_good, FUN=mean)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2450 mean_conf <- rename_column(mean_conf, "PMD_FDR_input_score", "mean_conf")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2451 min_conf <- aggregate(PMD_FDR_input_score~conf_group, data=data_TD_good, FUN=min)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2452 min_conf <- rename_column(min_conf, "PMD_FDR_input_score", "min_conf")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2453 max_conf <- aggregate(PMD_FDR_input_score~conf_group, data=data_TD_good, FUN=max)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2454 max_conf <- rename_column(max_conf, "PMD_FDR_input_score", "max_conf")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2455
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2456 mean_results <- mean_i_fdr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2457 mean_results <- merge(mean_results, sd_i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2458 mean_results <- merge(mean_results, n_i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2459 mean_results <- merge(mean_results, mean_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2460 mean_results <- merge(mean_results, min_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2461 mean_results <- merge(mean_results, max_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2462
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2463 mean_results$se <- with(mean_results, sd_i_fdr / sqrt(n - 1))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2464 mean_results$lower <- with(mean_results, mean_i_fdr - 2*se)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2465 mean_results$upper <- with(mean_results, mean_i_fdr + 2*se)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2466 return(mean_results)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2467 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2468 get_data_TD_good = function(i_fdr=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2469 data_TD_good <- subset(i_fdr, TD_good==TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2470 data_TD_good <- data_TD_good[order(data_TD_good$PMD_FDR_input_score),]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2471 n <- nrow(data_TD_good)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2472 data_TD_good$conf_group <- cut(1:n, breaks=floor(n/100))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2473 data_TD_good$i_fdr <- 100 * data_TD_good$i_fdr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2474 return(data_TD_good)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2475 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2476 get_modified_fdr = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2477 i_fdr <- data_processor()$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2478 i_fdr$PMD_good <- i_fdr$i_fdr < 0.01
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2479 i_fdr$TD_good <- i_fdr$is_in_1percent == TRUE
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2480 i_fdr$conf_good <- i_fdr$PMD_FDR_input_score == 100
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2481 return(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2482 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2483 one_percent_calculation_exists = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2484 data_processor()$raw_1_percent$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2485 return(data_processor()$raw_1_percent$exists())# "is_in_1percent" %in% colnames(data_processor()$i_fdr))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2486 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2487 report_good_discrepancies = function(i_fdr=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2488 with(subset(i_fdr, (PMD_FDR_decoy == 0)), print(table(TD_good, PMD_good)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2489 with(subset(i_fdr, (PMD_FDR_input_score==100) & (PMD_FDR_decoy == 0)), print(table(TD_good, PMD_good)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2490 with(subset(i_fdr, (PMD_FDR_input_score>= 99) & (PMD_FDR_input_score<100) & (PMD_FDR_decoy == 0)), print(table(TD_good, PMD_good)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2491 with(subset(i_fdr, (PMD_FDR_input_score>= 99) & (PMD_FDR_input_score<100) & (PMD_FDR_decoy == 0)), print(table(TD_good, PMD_good)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2492 with(subset(i_fdr, (PMD_FDR_input_score>= 90) & (PMD_FDR_input_score< 99) & (PMD_FDR_decoy == 0)), print(table(TD_good, PMD_good)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2493 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2494
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2495 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2496
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2497 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2498 # Class: Plot_Density_PMD_by_Score
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2499 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2500 Plot_Density_PMD_by_Score = setRefClass("Plot_Density_PMD_by_Score",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2501 contains = "Plot_Image",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2502 fields = list(show_norm = "logical"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2503 Plot_Density_PMD_by_Score$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2504 initialize = function(p_show_norm=FALSE, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2505 show_norm <<- p_show_norm
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2506 plot_title <<- "PMD distribution, by Confidence ranges"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2507 callSuper(...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2508
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2509 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2510 data_processor = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2511 return(data_processors[[1]])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2512 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2513 get_n = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2514 return(nrow(data_processor()$data_groups$df))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2515 #data_subset <- data_collection$i_fdr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2516 #return(nrow(data_subset))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2517 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2518 get_modified_data_groups = function(var_value = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2519 # Note: Filters out used_to_find_middle
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2520 # Note: Creates "value_of_interest" field
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2521 # Note: Remakes "group_decoy_input_score" field
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2522 data_new <- data_processor()$data_groups$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2523 data_new <- subset(data_new, !used_to_find_middle )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2524 data_new$value_of_interest <- data_new[, var_value]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2525
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2526 cutoff_points <- c(100, 100, 95, 80, 50, 0, 0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2527 n <- length(cutoff_points)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2528 uppers <- cutoff_points[-n]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2529 lowers <- cutoff_points[-1]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2530
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2531 for (i in 1:(n-1)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2532 upper <- uppers[i]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2533 lower <- lowers[i]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2534
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2535
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2536 if (lower==upper){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2537 idx <- with(data_new, which( (PMD_FDR_input_score == upper) & (PMD_FDR_decoy == 0)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2538 cat_name <- sprintf("%d", upper)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2539 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2540 idx <- with(data_new, which((PMD_FDR_input_score >= lower) & (PMD_FDR_input_score < upper) & (PMD_FDR_decoy == 0)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2541 cat_name <- sprintf("%02d - %2d", lower, upper)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2542 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2543 data_new$group_decoy_input_score[idx] <- cat_name
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2544 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2545
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2546 return(data_new)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2547 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2548 plot_image = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2549
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2550 # Support functions for plot_density_PMD_by_score()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2551
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2552 get_densities <- function(data_subset = NULL, var_value = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2553
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2554 # Support functions for get_densities()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2555
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2556 # New version
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2557
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2558 # Main body of get_densities()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2559
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2560 data_subset <- get_modified_data_groups(var_value=var_value)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2561 #data_subset$value_of_interest <- data_subset[,var_value]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2562 from <- min(data_subset$value_of_interest, na.rm=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2563 to <- max(data_subset$value_of_interest, na.rm=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2564 xlim = range(data_subset$value_of_interest, na.rm=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2565
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2566 groups <- sort(unique(data_subset$group_decoy_input_score), decreasing = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2567 n_groups <- length(groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2568
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2569 densities <- list(var_value = var_value, groups=groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2570
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2571 for (i in 1:n_groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2572 group <- groups[i]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2573
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2574 data_group_single <- subset(data_subset, (group_decoy_input_score == group))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2575 d_group <- with(data_group_single , density(value_of_interest, from = from, to = to, na.rm = TRUE))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2576 d_group <- normalize_density(d_group)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2577
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2578 densities[[group]] <- d_group
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2579 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2580
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2581 return(densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2582
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2583 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2584 get_xlim <- function(densities_a = NULL, densities_b = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2585 groups <- densities_a$groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2586
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2587 xlim <- 0
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2588 for (group in groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2589 xlim <- range(xlim, densities_a[[group]]$x, densities_b[[group]]$x)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2590 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2591
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2592 return(xlim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2593
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2594 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2595 get_ylim <- function(densities_a = NULL, densities_b = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2596 groups <- densities_a$groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2597
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2598 ylim <- 0
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2599 for (group in groups){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2600 ylim <- range(ylim, densities_a[[group]]$y, densities_b[[group]]$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2601 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2602
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2603 return(ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2604
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2605 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2606 plot_distributions <- function(densities = NULL, var_value= NULL,include_peak_dots=TRUE, xlab_modifier="", xlim=NULL, ylim=NULL, ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2607 data_groups <- get_modified_data_groups(var_value=var_value)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2608 groups <- sort(unique(data_groups$group_decoy_input_score))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2609 n_groups <- length(groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2610
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2611 groups_std <- setdiff(groups, c("100", "decoy", "0") )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2612 groups_std <- sort(groups_std, decreasing = TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2613 groups_std <- c(groups_std, "0")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2614 n_std <- length(groups_std)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2615 cols <- rainbow_with_fixed_intensity(n = n_std, goal_intensity_0_1 = 0.5, alpha=0.5)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2616
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2617 leg <- list(group = c("100" , groups_std , "decoy" ),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2618 leg = c("100" , groups_std , "All Decoys" ),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2619 col = c(col2hex("black") , cols , col2hex("purple", col_alpha = 0.5)),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2620 lwd = c(4 , rep(2, n_std), 4 ),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2621 title = "Confidence Score")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2622
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2623 xlab = sprintf("Precursor Mass Discrepancy%s (ppm)",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2624 xlab_modifier)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2625 ylab = "Density"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2626 if (!include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2627 xlab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2628 ylab=""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2629 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2630
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2631
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2632 plot( x=xlim, y=ylim, col=leg$col[1], lwd=leg$lwd[1] * scale, main=main, xlab=xlab, ylab=ylab, xaxt="n", yaxt="n", cex=scale, type="n")#, lty=leg.lty[1], ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2633
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2634 include_peak_dots = FALSE # BUGBUG: Disabling this for now. Need to move this to class parameter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2635
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2636 for (i in 1:length(leg$group)){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2637 group <- leg$group[i]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2638 d <- densities[[group]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2639 lines(d, col=leg$col[i], lwd=leg$lwd[i] * scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2640 if (include_peak_dots){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2641 x=d$x[which.max(d$y)]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2642 y=max(d$y)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2643 points(x=c(x,x), y=c(0,y), pch=19, col=leg$col[i], cex=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2644 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2645 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2646
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2647 abline(v=0, lwd=scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2648
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2649 if (include_text){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2650 legend_object = Legend_Object$new(leg, scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2651 legend_object$show()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2652 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2653
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2654 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2655
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2656 # Main body for plot_density_PMD_by_score()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2657
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2658 data_groups <- data_processor()$data_groups$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2659
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2660 data_subset_a <- subset(data_groups , used_to_find_middle == FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2661 data_subset_b <- subset(data_subset_a, PMD_FDR_peptide_length > 11)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2662
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2663 densities_a <- get_densities(data_subset = data_subset_a, var_value = "value")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2664 densities_b <- get_densities(data_subset = data_subset_b, var_value = "value_norm")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2665
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2666 xlim=get_xlim(densities_a, densities_b)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2667 ylim=get_ylim(densities_a, densities_b)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2668
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2669 dataset_name <- data_processor()$info$collection_name()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2670 if (show_norm){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2671 plot_distributions(densities=densities_b, var_value = "value_norm", xlab_modifier = " - normalized", xlim=xlim, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2672 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2673 plot_distributions(densities=densities_a, var_value = "value" , xlab_modifier = "" , xlim=xlim, ylim=ylim)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2674 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2675 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2676 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2677 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2678 # Class: Plot_Dataset_Description
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2679 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2680 Plot_Dataset_Description = setRefClass("Plot_Dataset_Description",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2681 contains = "Plot_Multiple_Images",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2682 fields = list(ylim_time_invariance = "numeric"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2683 Plot_Dataset_Description$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2684 initialize = function(p_data_processors = NULL,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2685 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2686 p_include_main=FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2687 p_ylim_time_invariance = c(-4,4), ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2688 plot_object_r1_c1 <- Plot_Time_Invariance_Alt$new(p_data_processors=p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2689 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2690 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2691 p_training_class = "good_testing",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2692 p_field_of_interest = "value",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2693 p_ylim = p_ylim_time_invariance)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2694
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2695 plot_object_r1_c2 <- Plot_Time_Invariance_Alt$new(p_data_processors=p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2696 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2697 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2698 p_training_class = "good_testing",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2699 p_field_of_interest = "value_norm",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2700 p_ylim = p_ylim_time_invariance)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2701 plot_object_r2_c1 <- Plot_Density_PMD_by_Score$new(p_data_processors=p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2702 p_show_norm=FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2703 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2704 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2705
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2706 plot_object_r2_c2 <- Plot_Density_PMD_and_Norm_Decoy_by_AA_Length$new(p_data_processors=p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2707 p_show_norm=FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2708 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2709 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2710
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2711 plot_object_r3_c1 <- Plot_Density_PMD_by_Score$new(p_data_processors=p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2712 p_show_norm=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2713 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2714 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2715 plot_object_r3_c2 <- Plot_Density_PMD_and_Norm_Decoy_by_AA_Length$new(p_data_processors=p_data_processors,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2716 p_show_norm=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2717 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2718 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2719 callSuper(p_n_images_wide=2,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2720 p_n_images_tall=3,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2721 p_include_text=p_include_text,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2722 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2723 p_image_list = list(plot_object_r1_c1, plot_object_r1_c2,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2724 plot_object_r2_c1, plot_object_r2_c2,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2725 plot_object_r3_c1, plot_object_r3_c2), ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2726
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2727 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2728 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2729 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2730 # Class: Plots_for_Paper
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2731 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2732 Plots_for_Paper <- setRefClass("Plots_for_Paper", fields =list(data_processor_a = "Data_Processor",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2733 data_processor_b = "Data_Processor",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2734 data_processor_c = "Data_Processor",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2735 data_processor_d = "Data_Processor",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2736 include_text = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2737 include_main = "logical",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2738 mai = "numeric"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2739 Plots_for_Paper$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2740 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2741 data_processor_a <<- Data_Processor$new(p_info = Data_Object_Info_737_two_step$new())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2742 data_processor_b <<- Data_Processor$new(p_info = Data_Object_Info_737_combined$new())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2743 data_processor_c <<- Data_Processor$new(p_info = Data_Object_Pyrococcus_tr $new())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2744 data_processor_d <<- Data_Processor$new(p_info = Data_Object_Mouse_Mutations $new())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2745 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2746 create_plots_for_paper = function(include_main=TRUE, finalize=TRUE){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2747 print_table_4_data()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2748 print_figure_2_data()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2749 plot_figure_D(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2750 plot_figure_C(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2751 plot_figure_B(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2752 plot_figure_A(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2753 plot_figure_8(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2754 plot_figure_7(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2755 plot_figure_6(p_scale=ifelse(finalize, 4, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2756 plot_figure_5(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2757 plot_figure_4(p_scale=ifelse(finalize, 2, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2758 plot_figure_3(p_scale=ifelse(finalize, 4, 1), p_include_main = include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2759 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2760 print_figure_2_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2761 print(create_stats_for_grouping_figure(list(data_processor_a)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2762 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2763 print_table_4_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2764 report_ranges_of_comparisons(processors = list(data_processor_a))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2765 report_ranges_of_comparisons(processors = list(data_processor_c))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2766 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2767 plot_figure_3 = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2768 plot_object <- Plot_Compare_PMD_and_Norm_Density$new(p_data_processor = list(data_processor_a),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2769 p_show_norm = FALSE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2770 p_include_text = TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2771 p_include_main = p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2772 p_display_n_psms = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2773 plot_object$plot_image_in_small_window(p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2774 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2775 plot_figure_4 = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2776 plot_object <- Plot_Time_Invariance_Alt_Before_and_After$new(p_data_processors = list(data_processor_a),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2777 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2778 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2779 p_ylim = c(-4,4))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2780 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2781
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2782 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2783 plot_figure_5 = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2784 plot_object <- Plot_Density_PMD_and_Norm_Decoy_by_AA_Length$new(p_data_processors = list(data_processor_a),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2785 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2786 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2787 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2788 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2789 plot_figure_6 = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2790 plot_object <- Plot_Bad_CI$new(p_data_processors = list(data_processor_a),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2791 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2792 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2793 plot_object$plot_image_in_small_window(p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2794 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2795 plot_figure_7 = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2796 plot_object <- Plot_Compare_iFDR_Confidence_1_Percent_TD_FDR$new(p_data_processors = list(data_processor_a),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2797 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2798 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2799 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2800 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2801 plot_figure_8 = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2802 plot_object <- Plot_Selective_Loss$new(p_data_processors = list(data_processor_c),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2803 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2804 p_include_main=p_include_main)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2805 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2806 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2807 plot_figure_A = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2808 plot_object <- Plot_Dataset_Description$new(p_data_processors=list(data_processor_a),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2809 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2810 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2811 p_ylim_time_invariance=c(-4,4) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2812 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2813 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2814 plot_figure_B = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2815 plot_object <- Plot_Dataset_Description$new(p_data_processors=list(data_processor_b),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2816 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2817 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2818 p_ylim_time_invariance=c(-4,4) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2819 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2820 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2821 plot_figure_C = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2822 plot_object <- Plot_Dataset_Description$new(p_data_processors=list(data_processor_c),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2823 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2824 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2825 p_ylim_time_invariance=c(-4,4) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2826 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2827 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2828 plot_figure_D = function(p_scale=NULL, p_include_main=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2829 plot_object <- Plot_Dataset_Description$new(p_data_processors=list(data_processor_d),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2830 p_include_text=TRUE,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2831 p_include_main=p_include_main,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2832 p_ylim_time_invariance=c(-4,4) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2833 plot_object$plot_image_in_large_window(window_height=4, p_scale=p_scale)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2834 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2835 create_stats_for_grouping_figure = function(processors=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2836 processor <- processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2837 processor$i_fdr$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2838 aug_i_fdr <- processor$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2839 aug_i_fdr$group_good_bad_other <- gsub("_.*", "", aug_i_fdr$group_training_class)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2840 aug_i_fdr$group_null <- "all"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2841 table(aug_i_fdr$group_training_class)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2842 table(aug_i_fdr$group_good_bad_other)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2843 table(aug_i_fdr$group_null)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2844
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2845 create_agg_fdr_stats <- function(i_fdr=NULL, grouping_var_name = NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2846 formula_fdr <- as.formula(sprintf("%s~%s", "i_fdr", grouping_var_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2847 formula_len <- as.formula(sprintf("%s~%s", "PMD_FDR_peptide_length", grouping_var_name))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2848 agg_fdr <- aggregate(formula=formula_fdr, data=i_fdr, FUN=mean)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2849 agg_n <- aggregate(formula=formula_fdr, data=i_fdr, FUN=length)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2850 agg_len <- aggregate(formula=formula_len, data=i_fdr, FUN=mean)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2851 agg_fdr <- rename_columns(df = agg_fdr,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2852 names_before = c(grouping_var_name, "i_fdr"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2853 names_after = c("group" , "fdr"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2854 agg_n <- rename_columns(df = agg_n,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2855 names_before = c(grouping_var_name, "i_fdr"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2856 names_after = c("group" , "n"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2857 agg_len <- rename_columns(df = agg_len,
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2858 names_before = c(grouping_var_name),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2859 names_after = c("group" ))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2860 agg <- merge(agg_fdr, agg_n)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2861 agg <- merge(agg , agg_len)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2862
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2863 return(agg)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2864 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2865
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2866 agg_detail <- create_agg_fdr_stats(i_fdr = aug_i_fdr, grouping_var_name = "group_training_class")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2867 agg_grouped <- create_agg_fdr_stats(i_fdr = aug_i_fdr, grouping_var_name = "group_good_bad_other")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2868 agg_all <- create_agg_fdr_stats(i_fdr = aug_i_fdr, grouping_var_name = "group_null")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2869
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2870 agg <- rbind(agg_detail, agg_grouped)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2871 agg <- rbind(agg, agg_all)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2872
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2873 agg$fdr <- ifelse(agg$fdr < 1, agg$fdr, 1)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2874
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2875 linear_combo <- function(x=NULL, a0=NULL, a1=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2876 result <- (a0 * (1-x) + a1 * x)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2877 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2878 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2879
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2880 agg$r <- linear_combo(agg$fdr, a0=197, a1= 47)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2881 agg$g <- linear_combo(agg$fdr, a0= 90, a1= 85)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2882 agg$b <- linear_combo(agg$fdr, a0= 17, a1=151)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2883
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2884 return(agg)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2885 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2886 report_ranges_of_comparisons = function(processors=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2887 report_comparison_of_Confidence_and_PMD = function (i_fdr = NULL, min_conf=NULL, max_conf=NULL, include_max=FALSE){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2888 report_PMD_confidence_comparison_from_subset = function(data_subset=NULL, group_name=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2889 print(group_name)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2890 print(sprintf(" Number of PSMs: %d", nrow(data_subset)))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2891 mean_confidence <- mean(data_subset$PMD_FDR_input_score)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2892 print(sprintf(" Mean Confidence Score: %3.1f", mean_confidence))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2893 print(sprintf(" PeptideShaker g-FDR: %3.1f", 100-mean_confidence))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2894 mean_PMD_FDR = mean(data_subset$i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2895 print(sprintf(" PMD g-FDR: %3.1f", 100*mean_PMD_FDR))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2896 #col <- col2hex("black", 0.2)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2897 #plot(data_subset$i_fdr, pch=".", cex=2, col=col)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2898 #abline(h=0)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2899 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2900
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2901 if (is.null(max_conf)) {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2902 data_subset <- subset(i_fdr, PMD_FDR_input_score == min_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2903 group_name <- sprintf("Group %d", min_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2904 } else if (include_max){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2905 data_subset <- subset(i_fdr, (PMD_FDR_input_score >= min_conf) & (PMD_FDR_input_score <= max_conf))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2906 group_name <- sprintf("Group %d through %d", min_conf, max_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2907 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2908 data_subset <- subset(i_fdr, (PMD_FDR_input_score >= min_conf) & (PMD_FDR_input_score < max_conf))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2909 group_name <- sprintf("Group %d to %d", min_conf, max_conf)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2910 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2911
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2912 report_PMD_confidence_comparison_from_subset(data_subset=data_subset, group_name=group_name)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2913 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2914
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2915 processor <- processors[[1]]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2916 processor$i_fdr$ensure()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2917 i_fdr <- processor$i_fdr$df
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2918 info <- processor$info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2919 print(sprintf("PMD and Confidence comparison for -- %s", info$collection_name()))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2920 report_comparison_of_Confidence_and_PMD(i_fdr = i_fdr, min_conf=100, max_conf=NULL, include_max=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2921 report_comparison_of_Confidence_and_PMD(i_fdr = i_fdr, min_conf= 99, max_conf=100 , include_max=FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2922 report_comparison_of_Confidence_and_PMD(i_fdr = i_fdr, min_conf= 90, max_conf= 99 , include_max=FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2923 report_comparison_of_Confidence_and_PMD(i_fdr = i_fdr, min_conf= 0, max_conf=100 , include_max=TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2924 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2925 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2926 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2927 # C - 021 - PMD-FDR Wrapper - functions.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2928 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2929 # Creates the necessary structure to convert the PMD-FDR code into one that #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2930 # can run as a batch file #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2931 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2932 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2933 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2934 # Class: ModuleArgParser_PMD_FDR
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2935 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2936 ModuleArgParser_PMD_FDR <- setRefClass("ModuleArgParser_PMD_FDR",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2937 contains = c("ArgParser"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2938 fields =list(args = "character") )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2939 ModuleArgParser_PMD_FDR$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2940 initialize = function(description = "Computes individual and global FDR using Precursor Mass Discrepancy (PMD-FDR)", ...){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2941 callSuper(description=description, ...)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2942 local_add_argument("--psm_report" , help="full name and path to the PSM report")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2943 local_add_argument("--psm_report_1_percent", default = "" , help="full name and path to the PSM report for 1% FDR")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2944 local_add_argument("--output_i_fdr" , default = "" , help="full name and path to the i-FDR output file ")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2945 local_add_argument("--output_g_fdr" , default = "" , help="full name and path to the g-FDR output file ")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2946 local_add_argument("--output_densities" , default = "" , help="full name and path to the densities output file ")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2947 #local_add_argument("--score_field_name" , default = "" , help="name of score field (in R format)")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2948 local_add_argument("--input_file_type" , default = "PMD_FDR_input_file", help="type of input file (currently supports: PSM_Report)")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2949 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2950 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2951 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2952 # Class: Data_Object_Parser
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2953 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2954 Data_Object_Parser <- setRefClass("Data_Object_Parser",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2955 contains = c("Data_Object"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2956 fields =list(parser = "ModuleArgParser_PMD_FDR",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2957 args = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2958 parsing_results = "list") )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2959 Data_Object_Parser$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2960 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2961 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2962 class_name <<- "Data_Object_Parser"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2963 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2964 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2965 # Nothing to do here - parser handles verification during load
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2966 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2967 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2968 if (length(args) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2969 parsing_results <<- parser$parse_arguments(NULL)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2970 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2971 parsing_results <<- parser$parse_arguments(args)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2972 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2973
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2974 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2975 set_args = function(p_args=NULL){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2976 # This is primarily used for testing. In operation arguments will be passed automatically (through use of commandArgs)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2977 args <<- p_args
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2978 set_dirty(TRUE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2979 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2980 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2981 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2982 # Class: Data_Object_Info_Parser
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2983 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2984 Data_Object_Info_Parser <- setRefClass("Data_Object_Info_Parser",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2985 contains = c("Data_Object_Info"),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2986 fields =list(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2987 output_i_fdr = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2988 output_g_fdr = "character",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2989 output_densities = "character"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2990 ) )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2991 Data_Object_Info_Parser$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2992 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2993 callSuper()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2994 class_name <<- "Data_Object_Info_Parser"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2995 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2996 verify = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2997 check_field_exists = function(field_name=NULL, check_empty = TRUE){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2998 field_value <- get_parser()$parsing_results[field_name]
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
2999 checkTrue(! is.null(field_value),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3000 msg = sprintf("Parameter %s was not passed to PMD_FDR", field_value))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3001 if (check_empty){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3002 checkTrue(! is.null(field_value),
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3003 msg = sprintf("Parameter %s was not passed to PMD_FDR", field_value))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3004 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3005 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3006 # Check parameters passed in
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3007 check_field_exists("junk")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3008 check_field_exists("psm_report")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3009 check_field_exists("psm_report_1_percent", check_empty = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3010 check_field_exists("output_i_fdr" , check_empty = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3011 check_field_exists("output_g_fdr" , check_empty = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3012 check_field_exists("output_densities" , check_empty = FALSE)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3013 #check_field_exists("score_field_name")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3014 check_field_exists("input_file_type")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3015 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3016 m_load_data = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3017 parsing_results <- get_parser()$parsing_results
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3018
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3019 data_file_name <<- as.character(parsing_results["psm_report"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3020 data_file_name_1_percent_FDR <<- as.character(parsing_results["psm_report_1_percent"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3021 data_path_name <<- as.character(parsing_results[""])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3022 #experiment_name <<- data_file_name
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3023 #designation <<- ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3024 output_i_fdr <<- as.character(parsing_results["output_i_fdr"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3025 output_g_fdr <<- as.character(parsing_results["output_g_fdr"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3026 output_densities <<- as.character(parsing_results["output_densities"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3027
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3028 input_file_type <<- as.character(parsing_results["input_file_type"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3029 #score_field_name <<- as.character(parsing_results["score_field_name"])
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3030 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3031 set_parser = function(parser){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3032 parents[["parser"]] <<- parser
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3033 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3034 get_parser = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3035 return(verified_element_of_list(parents, "parser", "Data_Object_Info_Parser$parents"))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3036 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3037 file_path = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3038 result <- data_file_name # Now assumes that full path is provided
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3039 if (length(result) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3040 stop("Unable to validate file path - file name is missing")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3041 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3042 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3043 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3044 file_path_1_percent_FDR = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3045 local_file_name <- get_data_file_name_1_percent_FDR()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3046 if (length(local_file_name) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3047 result <- ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3048 } else {
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3049 result <- local_file_name # path name is no longer relevant
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3050 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3051
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3052 # Continue even if file name is missing - not all analyses have a 1 percent FDR file; this is managed downstream
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3053
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3054 # if (length(result) == 0){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3055 # stop("Unable to validate file path - one or both of path name and file name (of 1 percent FDR file) are missing")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3056 # }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3057 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3058 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3059 get_data_file_name_1_percent_FDR = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3060 return(data_file_name_1_percent_FDR)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3061 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3062 collection_name = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3063 result <- ""
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3064 return(result)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3065 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3066
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3067 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3068 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3069 # Class: Processor_PMD_FDR_for_Galaxy
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3070 # Purpose: Wrapper on tools from Project 019 to enable a Galaxy-based interface
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3071 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3072 Processor_PMD_FDR_for_Galaxy <- setRefClass("Processor_PMD_FDR_for_Galaxy",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3073 fields = list(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3074 parser = "Data_Object_Parser",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3075 info = "Data_Object_Info_Parser",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3076 raw_data = "Data_Object_Raw_Data",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3077 raw_1_percent = "Data_Object_Raw_1_Percent",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3078 data_converter = "Data_Object_Data_Converter",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3079 data_groups = "Data_Object_Groupings",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3080 densities = "Data_Object_Densities",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3081 alpha = "Data_Object_Alpha",
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3082 i_fdr = "Data_Object_Individual_FDR"
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3083 ))
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3084 Processor_PMD_FDR_for_Galaxy$methods(
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3085 initialize = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3086 # This initialization defines all of the dependencies between the various components
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3087 # (Unfortunately, inheriting from Data_Processor leads to issues - I had to reimplement it here with a change to "info")
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3088
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3089 # info
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3090 info$set_parser(parser)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3091 parser$append_child(info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3092
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3093 # raw_data
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3094 raw_data$set_info(info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3095 info$append_child(raw_data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3096
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3097 # raw_1_percent
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3098 raw_1_percent$set_info(info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3099 info$append_child(raw_1_percent)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3100
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3101 # data_converter
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3102 data_converter$set_info (info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3103 data_converter$set_raw_data(raw_data)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3104 info $append_child (data_converter)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3105 raw_data $append_child (data_converter)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3106
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3107 # data_groups
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3108 data_groups$set_info (info)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3109 data_groups$set_data_converter(data_converter)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3110 data_groups$set_raw_1_percent (raw_1_percent)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3111 info $append_child (data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3112 data_converter$append_child (data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3113 raw_1_percent $append_child (data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3114
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3115 # densities
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3116 densities $set_data_groups(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3117 data_groups$append_child (densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3118
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3119 # alpha
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3120 alpha $set_densities(densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3121 densities$append_child (alpha)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3122
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3123 # i_fdr
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3124 i_fdr$set_data_groups(data_groups)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3125 i_fdr$set_densities (densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3126 i_fdr$set_alpha (alpha)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3127 data_groups $append_child(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3128 densities $append_child(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3129 alpha $append_child(i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3130
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3131 },
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3132 compute = function(){
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3133 #i_fdr is currently the lowest level object - it ultimately depends on everything else.
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3134 i_fdr$ensure() # All pieces on which i_fdr depends are automatically verified and computed (through their verify() and ensure())
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3135
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3136 save_standard_df(x = densities$df, file_path = info$output_densities)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3137 save_standard_df(x = alpha$df, file_path = info$output_g_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3138 save_standard_df(x = i_fdr$df, file_path = info$output_i_fdr)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3139 }
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3140 )
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3141 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3142 # D - 021 - PMD-FDR Main.R #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3143 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3144 # File Description: Contains the base code that interprets the parameters #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3145 # and computes i-FDR and g-FDR for a mass spec project #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3146 # #
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3147 ###############################################################################
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3148 argv <- commandArgs(TRUE) # Saves the parameters (command code)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3149
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3150 processor <- Processor_PMD_FDR_for_Galaxy$new()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3151 processor$parser$set_args(argv)
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3152 processor$compute()
5cc0c32d05a2 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/pmd_fdr commit 00f85eca73cd8afedfefbeec94a4462455ac1a9a"
galaxyp
parents:
diff changeset
3153