annotate mqppep_anova_script.Rmd @ 2:2336fbff8866 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
author galaxyp
date Mon, 12 Dec 2022 22:01:09 +0000
parents 08678c931f5d
children dda27b9273a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1 ---
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2 title: "MaxQuant Phosphoproteomic Enrichment Pipeline ANOVA/KSEA"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3 author:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4 - "Nick Graham^[ORCiD 0000-0002-6811-1941, University of Southern California: Los Angeles, CA, US]"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5 - "Larry Cheng^[ORCiD 0000-0002-6922-6433, Rutgers School of Graduate Studies: New Brunswick, NJ, US]"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6 - "Art Eschenlauer^[ORCiD 0000-0002-2882-0508, University of Minnesota: Minneapolis, Minnesota, US]"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
7 date:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
8 - "May 28, 2018"
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
9 - "; revised December 7, 2022"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
10 lot: true
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
11 output:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
12 pdf_document:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
13 toc: true
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
14 toc_depth: 2
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
15 keep_tex: true
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
16 dev: pdf
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
17 includes:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
18 in_header: mqppep_anova_preamble.tex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
19 latex_macros: false
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
20 raw_tex: true
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
21 urlcolor: blue
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
22 params:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
23 alphaFile: "test-data/alpha_levels.tabular"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
24 inputFile: "test-data/test_input_for_anova.tabular"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
25 preprocDb: "test-data/test_input_for_anova.sqlite"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
26 kseaAppPrepDb: !r c(":memory:", "test-data/mqppep.sqlite")[2]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
27 regexSampleNames: "\\.\\d+[A-Z]$"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
28 regexSampleGrouping: "\\d+"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
29 groupFilterPatterns: ".+"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
30 groupFilter: !r c("none", "exclude", "include")[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
31 imputationMethod: !r c("group-median", "median", "mean", "random")[4]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
32 kseaCutoffThreshold: !r c(0.05, 0.1, 0.25, 0.5, 0.9)[5]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
33 #imputationMethod: !r c("group-median", "median", "mean", "random")[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
34
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
35 # how should sample groups be interpreted?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
36 # - "f": fixed patterns (like `grep -F`)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
37 # - "p": PERL-compatible (like `grep -P`)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
38 # - "r": extended grep patterns (like `grep -E`)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
39 # use what case sensitivity?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
40 # - "i": case insensitive matching (like `grep -i`)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
41 groupFilterMode: !r c("r", "ri", "p", "pi", "f", "fi")[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
42 # what pattern should be used for the first column
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
43 # (extended grep pattern, case sensitive)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
44 firstDataColumn: "^Intensity[^_]"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
45 # for small random value imputation, what percentile should be center?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
46 meanPercentile: 50
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
47 #meanPercentile: 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
48 # for small random value imputation, what should `s / mean(x)` ratio be?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
49 sdPercentile: 1.0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
50 # output path for imputed data file
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
51 imputedDataFilename: "test-data/limbo/imputedDataFilename.txt"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
52 # output path for imputed/quantile-normalized/log-transformed data file
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
53 imputedQNLTDataFile: "test-data/limbo/imputedQNLTDataFile.txt"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
54 # output path for contents of `stats_metadata_v` table
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
55 anovaKseaMetadata: "test-data/limbo/anovaKseaMetadata.txt"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
56 # how to test one variable with > 2 categories (e.g., aov or kruskal.test)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
57 oneWayManyCategories: !r c("aov", "kruskal.test", "oneway.test")[1]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
58 # how to test one variable with 2 categories (e.g., oneway.test)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
59 oneWayTwoCategories: !r c("aov", "kruskal.test", "oneway.test")[3]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
60 # what should be the minimum quality for consideration in both
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
61 minQuality: 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
62 # correct KSEA with FDR (recommended) or raw p-value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
63 kseaCutoffStatistic: !r c("FDR", "p.value")[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
64 # correct KSEA threshold 0.05 (conventional) or higher (perhaps better)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
65 # "perhaps better" meaning that KSEA is an hypothesis-generator, not -test
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
66 #kseaCutoffThreshold: !r c(0.05, 0.1, 0.25, 0.5)[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
67 # minimum number of substrates required for a kinase to be considered in KSEA
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
68 kseaMinSubstrateCount: 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
69 # Should KSEA be performed aggregating signed log2FC or absolute?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
70 # FALSE use raw log2FC for KSEA as for KSEAapp::KSEA.Scores
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
71 # TRUE use abs(log2FC) for KSEA as Justin Drake requested; this is a
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
72 # justifiable deviation from the KSEAapp::KSEA.Scores algorithm.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
73 kseaUseAbsoluteLog2FC: TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
74 #kseaUseAbsoluteLog2FC: FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
75 # minimum number of observed values per sample-group
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
76 intensityMinValuesPerGroup: 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
77 # maximum number of heatmap rows (result are poor when > 50)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
78 intensityHeatmapRows: 50
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
79 # what should be the primary criterion to eliminate excessive heatmap rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
80 intensityHeatmapCriteria: !r c("quality", "na_count", "p_value")[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
81 # should correlation among substrates be used (rather than covariance)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
82 correlateSubstrates: TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
83 # only show covariance among variables having variance > 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
84 filterCovVarGT1: TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
85 # maximum number of residues to display for ppeps in rownames or columnames
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
86 ppepTruncN: 10
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
87 # maximum number of characters of subgenes to display in rownames or columnames
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
88 subgeneTruncN: 10
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
89 # maximum number of characters for paste(subgene, ppep) for enrichment plots
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
90 substTruncN: 20
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
91 # should boxplots use variable-width boxes to reflect # of samples
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
92 boxPlotVarWidth: TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
93 # should boxplots use notched boxes to reflect difference between samples
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
94 boxPlotNotch: TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
95 # look-up tables for kinase descriptions
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
96 kinaseNameUprtLutBz2: "./kinase_name_uniprot_lut.tabular.bz2"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
97 kinaseUprtDescLutBz2: "./kinase_uniprot_description_lut.tabular.bz2"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
98 # should debugging trace messages be printed?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
99 showEnrichedSubstrates: FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
100 # should debugging nb/nbe messages be printed?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
101 printNBMsgs: FALSE
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
102 # showld row-scaling be applied to heatmaps: "none" or "row"
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
103 defaultHeatMapRowScaling: "none"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
104 # should debugging trace messages be printed?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
105 printTraceMsgs: FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
106 # when debugging files are needed, set debugFileBasePath to the path
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
107 # to the directory where they should be written
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
108 debugFileBasePath: !r if (TRUE) NULL else "test-data"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
109 ---
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
110
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
111 ```{r setup, include = FALSE, results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
112
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
113 # simple debug messaging
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
114 print_nb_messages <- params$printNBMsgs
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
115
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
116 nb <- if (!print_nb_messages) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
117 function(...) invisible()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
118 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
119 function(..., f = cat) f("\n$\\exists{}\\supset\\forall{}$", ...)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
120 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
121
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
122 nbe <- if (!print_nb_messages) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
123 function(...) invisible()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
124 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
125 function(..., f = cat, file = stderr()) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
126 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
127 stringi::stri_unescape_unicode("\nNBE \\u2203\\u2283\\u2200"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
128 ...,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
129 file = file
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
130 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
131 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
132 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
133
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
134 #ref for debugging: https://yihui.org/tinytex/r/#debugging
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
135 options(tinytex.verbose = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
136
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
137 # ref for parameterizing Rmd document: https://stackoverflow.com/a/37940285
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
138 # ref for top and bottom struts: https://tex.stackexchange.com/a/50355
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
139 knitr::opts_chunk$set(echo = FALSE, fig.dim = c(9, 10), dpi = 300)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
140
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
141 # freeze the random number generator so the same results will be produced
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
142 # from run to run
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
143 set.seed(28571)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
144
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
145 ### LIBRARIES
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
146
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
147 if (print_nb_messages) nbe("library(gplots)")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
148 library(gplots)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
149 if (print_nb_messages) nbe("library(caret)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
150 # load caret for nearZeroVar
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
151 if (print_nb_messages) nbe("Please ignore the messages about systemd, if any.\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
152 library(caret)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
153 if (print_nb_messages) nbe("library(DBI)")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
154 library(DBI)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
155 if (print_nb_messages) nbe("library(RSQLite)")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
156 library(RSQLite)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
157 if (print_nb_messages) nbe("library(sqldf)\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
158 # Suppress "Warning: no DISPLAY variable so Tk is not available"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
159 suppressWarnings(suppressMessages(library(sqldf)))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
160
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
161 # required but not added to search list:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
162 # - DBI
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
163 # - RSQLite
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
164 # - ggplot2
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
165 # - knitr
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
166 # - latex2exp
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
167 # - preprocessCore
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
168 # - reshape2
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
169 # - vioplot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
170
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
171 ### CONSTANTS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
172
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
173 const_boxplot_fill <- "grey94"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
174 const_ksea_astrsk_kinases <- 1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
175 const_ksea_nonastrsk_kinases <- 2
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
176 const_ksea_all_kinases <- 3
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
177 const_log10_e <- log10(exp(1))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
178 const_stripchart_cex <- 0.5
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
179 const_stripchart_jitter <- 0.3
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
180 const_table_anchor_bp <- "bp"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
181 const_table_anchor_ht <- "ht"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
182 const_table_anchor_p <- "p"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
183 const_table_anchor_t <- "t"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
184 const_table_anchor_tbp <- "tbp"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
185
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
186
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
187 ### GLOBAL VARIABLES (params)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
188
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
189 ## functions to process params
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
190
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
191 is_string_null_or_empty <- function(x) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
192 # N. B. non-strings are intentionally treated as NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
193 if (is.null(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
194 TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
195 else if (!is.character(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
196 TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
197 else x == ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
198 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
199
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
200 ##' Catch *and* save both errors and warnings, and in the case of
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
201 ##' a warning, also keep the computed result.
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
202 ##' return result as list(value = ..., warning = ...)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
203 ##' - value will be:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
204 ##' - the result if no exception is thrown
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
205 ##' - the exception if an exception is caught
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
206 ##' - warning will be a string except perhaps when warning argument is not NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
207 ##'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
208 ##' adapted from `demo(error.catching)`
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
209 ##'
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
210 ##' @title tryCatch both warnings (with value) and errors
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
211 ##' @param expr an \R expression to evaluate
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
212 ##' @return a list with 'value' and 'warning', where
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
213 ##' 'value' may be an error caught.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
214 ##' @author Martin Maechler;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
215 ##' Copyright (C) 2010-2012 The R Core Team
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
216 try_catch_w_e <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
217 function(expr, error = function(e) e, warning = NULL) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
218 wrn <- NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
219 # warning handler
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
220 w_handler <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
221 if (is.function(warning))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
222 warning
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
223 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
224 function(w) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
225 wrn <<- w
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
226 invokeRestart("muffleWarning")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
227 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
228 e_handler <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
229 if (is.function(error))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
230 error
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
231 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
232 function(e) e
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
233 # return result as list(value = ..., warning = ...)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
234 # - value will be:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
235 # - the result if no exception is thrown
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
236 # - the exception if an exception is caught
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
237 list(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
238 value = withCallingHandlers(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
239 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
240 expr,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
241 error = e_handler
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
242 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
243 warning = w_handler
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
244 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
245 warning = wrn
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
246 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
247 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
248
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
249 see_kvp <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
250 function(format, key, value, suffix = "") {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
251 if (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
252 !all(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
253 is.character(format),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
254 is.character(key),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
255 is.character(value),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
256 is.character(suffix)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
257 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
258 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
259 cat("all arguments to see_kvp should be character")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
260 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
261 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
262 result <- sprintf(format, value)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
263 if (length(result) > 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
264 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
265 "%s = c(%s)%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
266 whack_underscores(key),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
267 paste(result, collapse = ", "),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
268 suffix
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
269 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
270 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
271 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
272 "%s = %s%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
273 key,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
274 result,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
275 suffix
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
276 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
277 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
278 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
279
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
280 see_logical <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
281 function(x, suffix = "", xprssn = deparse1(substitute(x))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
282 result <- as.character(as.logical(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
283 # handle NAs and NaNs
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
284 result[is.na(result)] <- "NA"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
285 see_kvp(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
286 format = "%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
287 key = xprssn,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
288 value = result,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
289 suffix = suffix
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
290 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
291 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
292
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
293 see_numeric <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
294 function(x, suffix = "", digits = 3, xprssn = deparse1(substitute(x))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
295 if (is.numeric(digits) && is.numeric(x)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
296 digits <- as.integer(digits)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
297 digits <- min(16, max(0, digits))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
298 format <- paste0("%0.", as.character(digits), "g")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
299 result <- sprintf(format, x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
300 see_kvp(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
301 format = "%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
302 key = xprssn,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
303 value = result,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
304 suffix = suffix
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
305 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
306 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
307 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
308
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
309 see_character <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
310 function(x, suffix = "", xprssn = deparse1(substitute(x))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
311 if (is.character(x)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
312 see_kvp(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
313 format = "%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
314 key = xprssn,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
315 value = sprintf("\"%s\"", x),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
316 suffix = suffix
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
317 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
318 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
319 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
320
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
321 see_variable <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
322 function(x, suffix = "", digits = 3, xprssn = deparse1(substitute(x))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
323 if (is.character(x)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
324 see_character(x, suffix, xprssn)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
325 } else if (is.numeric(x)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
326 see_numeric(x, suffix, digits, xprssn)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
327 } else if (is.logical(x)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
328 see_logical(x, suffix, xprssn)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
329 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
330 f <- file("")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
331 sink(f)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
332 str(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
333 msg <- paste(readLines(f), collapse = "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
334 sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
335 close(f)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
336 paste0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
337 "see_variable - str(",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
338 xprssn,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
339 "):\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
340 msg, "\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
341 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
342 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
343 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
344
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
345 # ref: https://tug.org/texinfohtml/latex2e.html
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
346 # LaTeX sets aside the following characters for special purposes.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
347 # For example, the percent sign % is for comments.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
348 # They are called reserved characters or special characters.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
349 # They are all discussed elsewhere in this manual.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
350 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
351 # $ % & { } _ ~ ^ \ #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
352 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
353 # If you want a reserved character to be printed as itself, in the text body
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
354 # font, for all but the final three characters in that list simply put
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
355 # a backslash \ in front of the character.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
356 # Thus, typing \$1.23 will produce $1.23 in your output.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
357 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
358 # As to the last three characters, to get a tilde in the text body font,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
359 # use \~{} (omitting the curly braces would result in the next character
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
360 # receiving a tilde accent).
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
361 # Similarly, to get a text body font circumflex use \^{}.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
362 # To get a backslash in the font of the text body enter \textbackslash{}.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
363 whack_math <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
364 function(v) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
365 v <- as.character(v)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
366 w <- gsub("\\", "\\textbackslash ", v, fixed = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
367 w <- Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
368 f = function(l, r) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
369 gsub(r, paste0("\\", r), l, fixed = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
370 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
371 x = c("#", "$", "%", "&", "{", "}", "_"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
372 init = w
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
373 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
374 w <- gsub("^", "\\^{}", w, fixed = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
375 return(w)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
376 if (all(v == w))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
377 v
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
378 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
379 paste0("\\texttt{", w, "}")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
380 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
381 whack_underscores <- whack_math
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
382
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
383 ## dump params to stderr (remove this eventually)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
384
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
385 if (FALSE) nbe(see_variable(params))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
386
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
387 ## unlist params for eventual output
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
388
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
389 param_unlist <- unlist(as.list(params))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
390
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
391 # no need to whack underscores and dollars because this is verbatim
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
392 param_df <- data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
393 parameter = paste0("\\verb@", names(param_unlist), "@"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
394 value = paste0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
395 "\n\\begin{tiny}\n\\verb@",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
396 param_unlist,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
397 "@\n\\end{tiny}"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
398 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
399 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
400 param_df <- data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
401 parameter = names(param_unlist),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
402 value = param_unlist
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
403 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
404 param_df <- param_df[order(param_df$parameter), ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
405
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
406 ## general output control
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
407
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
408 debug_file_base_path <- params$debugFileBasePath
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
409 print_trace_messages <- params$printTraceMsgs
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
410 show_enriched_substrates <- params$showEnrichedSubstrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
411 boxplot_varwidth <- params$boxPlotVarWidth
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
412 boxplot_notch <- params$boxPlotNotch
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
413
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
414 ## parameters for static data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
415
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
416 kinase_name_uprt_lut_bz2 <- params$kinaseNameUprtLutBz2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
417 kinase_uprt_desc_lut_bz2 <- params$kinaseUprtDescLutBz2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
418
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
419 ## parameters for input file
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
420
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
421 preproc_db <- params$preprocDb
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
422 alpha_file <- params$alphaFile
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
423 input_file <- params$inputFile
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
424
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
425 # First data column - ideally, this could be detected via
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
426 # regexSampleNames, but for now leave it as is.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
427 first_data_column <- params$firstDataColumn
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
428 fdc_is_integer <- is.integer(first_data_column)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
429 if (fdc_is_integer) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
430 first_data_column <- as.integer(params$firstDataColumn)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
431 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
432
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
433 ## parameters for output files
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
434
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
435 ksea_app_prep_db <- params$kseaAppPrepDb
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
436 imputed_data_filename <- params$imputedDataFilename
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
437 imp_qn_lt_data_filenm <- params$imputedQNLTDataFile
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
438 anova_ksea_mtdt_file <- params$anovaKseaMetadata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
439
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
440 ## parameters for imputation
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
441
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
442 # Imputation method, should be one of
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
443 # "random", "group-median", "median", or "mean"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
444 imputation_method <- params$imputationMethod
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
445
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
446 # Selection of percentile of logvalue data to set the mean for random number
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
447 # generation when using random imputation
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
448 mean_percentile <- params$meanPercentile / 100.0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
449
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
450 # deviation adjustment-factor for random values; real number.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
451 sd_percentile <- params$sdPercentile
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
452
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
453 ## parameters for group parsing and filtering
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
454
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
455 # Regular expression of Sample Names, e.g., "\\.(\\d+)[A-Z]$"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
456 regex_sample_names <- params$regexSampleNames
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
457 # Regular expression to extract Sample Grouping from Sample Name;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
458 # if error occurs, compare smpl_trt vs. sample_name_matches
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
459 # to see if groupings/pairs line up
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
460 # e.g., "(\\d+)"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
461
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
462 regex_sample_grouping <- params$regexSampleGrouping
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
463 # What are the patterns for filtering sample groups?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
464 # How should sample groups be filtered?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
465 # - none: do not filter
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
466 # - include: include sample groups matching filter
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
467 # - exclude: include sample groups not matching filter
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
468
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
469 sample_group_filter <- params$groupFilter
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
470 if (grepl("f", params$groupFilterMode, fixed = TRUE)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
471 sample_group_filter_perl <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
472 sample_group_filter_fixed <- TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
473 } else if (grepl("p", params$groupFilterMode, fixed = TRUE)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
474 sample_group_filter_perl <- TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
475 sample_group_filter_fixed <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
476 } else { # normal regex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
477 sample_group_filter_perl <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
478 sample_group_filter_fixed <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
479 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
480
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
481 sample_group_filter_nocase <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
482 grepl("i", params$groupFilterMode, fixed = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
483
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
484 # What PCRE patterns should be included or excluded
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
485 group_filter_patterns_csv <- params$groupFilterPatterns
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
486 sample_group_filter_patterns <- strsplit(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
487 x = group_filter_patterns_csv,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
488 split = ",",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
489 fixed = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
490 )[[1]]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
491
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
492 ## parameters for hypothesis testing
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
493
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
494 one_way_all_categories_fname <- params$oneWayManyCategories
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
495
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
496 one_way_all_categories <- try_catch_w_e(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
497 match.fun(one_way_all_categories_fname))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
498
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
499 if (!is.function(one_way_all_categories$value)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
500 write("fatal error for parameter oneWayManyCategories:", stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
501 write(one_way_all_categories$value$message, stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
502 if (sys.nframe() > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
503 cat("Cannot continue and quit() failed. Goodbye.")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
504 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
505 quit(save = "no", status = 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
506 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
507 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
508
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
509 one_way_all_categories <- one_way_all_categories$value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
510
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
511 one_way_two_categories_fname <- params$oneWayManyCategories
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
512 one_way_two_categories <- try_catch_w_e(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
513 match.fun(one_way_two_categories_fname))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
514 if (!is.function(one_way_two_categories$value)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
515 cat("fatal error for parameter oneWayTwoCategories: \n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
516 cat(one_way_two_categories$value$message, fill = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
517 if (sys.nframe() > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
518 cat("Cannot continue and quit() failed. Goodbye.")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
519 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
520 quit(save = "no", status = 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
521 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
522 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
523 one_way_two_categories <- one_way_two_categories$value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
524
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
525 ## parameters for KSEA
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
526
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
527 ksea_cutoff_statistic <- params$kseaCutoffStatistic
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
528 ksea_cutoff_threshold <- params$kseaCutoffThreshold
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
529 ksea_min_substrate_count <- params$kseaMinSubstrateCount
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
530
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
531 ## parameters for global variables consumed by functions
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
532
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
533 # intensityHeatmapCriteria: !r c("na_count", "p_value")[2] # TODO switch to 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
534 # TODO Validate within list
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
535 g_intensity_hm_criteria <- params$intensityHeatmapCriteria
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
536 if (is_string_null_or_empty(g_intensity_hm_criteria)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
537 cat("invalid intensityHeatmapCriteria parameter (must be string)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
538 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
539 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
540 switch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
541 g_intensity_hm_criteria,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
542 "quality" = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
543 "na_count" = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
544 "p_value" = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
545 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
546 with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
547 params,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
548 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
549 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
550 "invalid %s (must be %s)",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
551 see_variable(intensityHeatmapCriteria),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
552 "one of quality or na_count or p_value"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
553 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
554 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
555 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
556 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
557 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
558 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
559
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
560 g_default_heatmap_row_scaling <-
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
561 params$defaultHeatMapRowScaling
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
562 if (
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
563 !is.character(g_default_heatmap_row_scaling) ||
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
564 !(g_default_heatmap_row_scaling %in% c("row", "none"))
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
565 ) {
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
566 cat("invalid defaultHeatMapRowScaling (must be 'row' or 'none')")
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
567 knitr::knit_exit()
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
568 }
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
569
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
570 # intensityHeatmapRows: 50
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
571 # TODO Validate >> 0 < 75
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
572 g_intensity_hm_rows <- params$intensityHeatmapRows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
573 if (!is.integer(g_intensity_hm_rows) || g_intensity_hm_rows < 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
574 cat("invalid intensityHeatmapRows (must be integer > 0)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
575 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
576 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
577
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
578 g_intensity_min_per_class <- params$intensityMinValuesPerGroup
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
579 if (!is.integer(g_intensity_min_per_class) || g_intensity_min_per_class < 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
580 cat("invalid intensityMinValuesPerGroup (must be integer > -1")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
581 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
582 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
583
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
584 if (is.na(as.logical(g_correlate_substrates <- params$correlateSubstrates))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
585 cat("invalid correlateSubstrates (must be TRUE or FALSE)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
586 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
587 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
588
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
589 if (is.na(as.logical(g_filter_cov_var_gt_1 <- params$filterCovVarGT1))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
590 cat("invalid filterCovVarGT1 parameter (must be TRUE or FALSE)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
591 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
592 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
593
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
594 # TODO Validate >> 0 < 30
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
595 g_ppep_trunc_n <- params$ppepTruncN
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
596
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
597 # TODO Validate >> 0 < 30
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
598 g_subgene_trunc_n <- params$subgeneTruncN
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
599
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
600 # TODO Validate >> 0 < 30
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
601 g_sbstr_trunc_n <- params$substTruncN
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
602
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
603
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
604 ### OPERATORS
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
605
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
606 # Test for exclusion
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
607 # ref: https://www.reneshbedre.com/blog/in-operator-r.html
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
608 `%notin%` <- Negate(`%in%`)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
609
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
610 # Augmented assignment
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
611 # ref: https://www2.cs.arizona.edu/icon/refernce/infix2.htm#aug_assign
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
612 `%||:=%` <- function(lvalue, ...) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
613 pf <- parent.frame()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
614 rvalue <- Reduce(paste0, x = ..., init = lvalue)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
615 assign(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
616 x = as.character(substitute(lvalue)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
617 value = rvalue,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
618 pos = pf
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
619 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
620 invisible(rvalue)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
621 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
622
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
623 ### FUNCTIONS
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
624
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
625 no_op <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
626 function() {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
627 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
628 # this function is not used in this file and should be removed while
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
629 # factoring out reusable code
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
630 all_apply <- function(f, v, na_rm = TRUE, ...) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
631 Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
632 f = function(l, r) if (na_rm && is.na(r)) TRUE else l && r,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
633 x = sapply(X = v, FUN = f, ...),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
634 init = TRUE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
635 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
636 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
637
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
638 write_debug_file <- function(data_frame) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
639 if (!is.null(debug_file_base_path)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
640 s_path <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
641 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
642 "%s/%s.txt",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
643 debug_file_base_path,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
644 deparse(substitute(data_frame))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
645 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
646 write.table(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
647 data_frame,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
648 file = s_path,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
649 sep = "\t",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
650 col.names = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
651 row.names = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
652 quote = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
653 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
654 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
655 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
656
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
657 # ref: http://adv-r.had.co.nz/Environments.html
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
658 # "When creating your own environment, note that you should set its parent
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
659 # environment to be the empty environment. This ensures you don't
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
660 # accidentally inherit objects from somewhere else."
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
661 # Caution: this prevents `with(my_env, expr)` from working when `expr`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
662 # contains anything from the global environment, even operators!
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
663 # Hence, `x <- 1; get("x", new_env())` fails by design.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
664 new_env <- function() {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
665 new.env(parent = emptyenv())
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
666 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
667
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
668 # make apply readable for rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
669 row_apply <- function(x, fun, ..., simplify = TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
670 apply(x, MARGIN = 1, fun, ..., simplify = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
671 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
672
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
673 # make apply readable for columns
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
674 column_apply <- function(x, fun, ..., simplify = TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
675 apply(x, MARGIN = 2, fun, ..., simplify = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
676 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
677
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
678 ##' Produce a vector of boolean values whose i-th value is TRUE when any
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
679 ##' member of v matches the i-th membr of s, where i in 1:seq_len(length(s))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
680 ##'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
681 ##' @title Search multiple strings for matches of multiple substrings
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
682 ##' @param v a vector of substrings to match
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
683 ##' @param s a vector of strings to search for matches
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
684 ##' @param ... additional arguments to grepl
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
685 ##' @return a list with keys in s and valuse that are vectors of elements of v
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
686 ##' @author Art Eschenlauer
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
687 ##' Copyright (C) 2022 Art Eschenlauer;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
688 ##' MIT License; https://en.wikipedia.org/wiki/MIT_License#License_terms
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
689 mgrepl <- function(v, s, ...) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
690 grpl_rslt <- rep_len(0, length(s))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
691 for (vi in v) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
692 grpl_rslt_v <- sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
693 X = s,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
694 FUN = function(t) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
695 Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
696 f = function(l, r) if (is.null(l)) r else c(l, r),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
697 x = sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
698 X = vi,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
699 FUN = function(f) grepl(f, t, ...)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
700 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
701 init = c()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
702 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
703 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
704 simplify = "array"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
705 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
706 grpl_rslt <- grpl_rslt + grpl_rslt_v
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
707 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
708 rslt <- unname(grpl_rslt > 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
709 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
710
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
711 ##' Produce positions in a vector where succeeding value != current valus
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
712 ##'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
713 ##' @title Search vector for neighboring positions having different values
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
714 ##' @param v a vector of comparable numeric values (e.g. integers)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
715 ##' @return a vector of positions i where v[i] != v[i + 1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
716 ##' @author Art Eschenlauer
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
717 ##' Copyright (C) 2022 Art Eschenlauer;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
718 ##' MIT License; https://en.wikipedia.org/wiki/MIT_License#License_terms
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
719 transition_positions <- function(v) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
720 Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
721 f = function(l, i) if ((i != 1) && (v[i - 1] != v[i])) c(l, i - 1) else l,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
722 x = seq_along(v)[-1:0],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
723 init = c()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
724 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
725 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
726
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
727 ### figure debug functions
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
728
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
729 cat_par_vector <- function(par_name, lbl = "", newlines = TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
730 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
731 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
732 "%spar(%s) = c(%s)%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
733 lbl,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
734 par_name,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
735 paste(par(par_name), collapse = ", "),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
736 if (newlines) "\n\n" else ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
737 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
738 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
739 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
740
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
741 cat_margins <- function(lbl = NULL) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
742 for (p in c("fig", "fin", "mar", "mai", "omd", "omi", "oma"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
743 cat_par_vector(p, if (!is.null(lbl)) paste0(lbl, " ") else NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
744 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
745
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
746 cat_variable <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
747 function(x, suffix = "", digits = 3, force_str = FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
748 xprssn <- deparse1(substitute(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
749 if (force_str || is.matrix(x) || is.list(x) || is.data.frame(x)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
750 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
751 paste0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
752 "\n\\texttt{\\textbf{",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
753 whack_underscores(xprssn),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
754 "}} [",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
755 typeof(x),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
756 ",",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
757 mode(x),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
758 "] =\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
759 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
760 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
761 cat("\n\\begin{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
762 str(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
763 cat("\n\\end{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
764 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
765 cat("\n", see_variable(x, suffix, digits, xprssn))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
766 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
767 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
768
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
769 ### structure helper functions
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
770
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
771 # ref: staque.R - Icon-oriented stack and queue operations
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
772 # - https://gist.github.com/eschen42/917690355e53918b9e7ba7138a02d1f8
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
773 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
774 # sq_get(v):x produces the leftmost element of v and removes it from v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
775 # but produces NA if v is empty
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
776 sq_get <- function(v) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
777 if (length(v) == 0) return(NA)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
778 assign(as.character(substitute(v)), v[-1], parent.frame())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
779 return(v[1])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
780 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
781 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
782 # sq_put(v,x1,...,xn):v puts x1, x2, ..., xn onto the right end of v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
783 # producing v.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
784 # Values are pushed in order from left to right,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
785 # so xn becomes the last (rightmost) value on v.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
786 # sq_put(v) with no second argument does nothing.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
787 sq_put <- function(v, x = NA, ...) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
788 pf <- parent.frame()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
789 if (is.null(x)) return(pf$v)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
790 if (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
791 !(length(x) > 1) &&
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
792 !rlang::is_closure(x) &&
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
793 is.na(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
794 ) return(pf$v)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
795 assign(as.character(substitute(v)), c(v, x, ...), pf)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
796 pf[[as.character(substitute(v))]]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
797 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
798
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
799 ### numerical/statistical helper functions
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
800
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
801 any_nan <- function(x) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
802 !any(x == "NaN")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
803 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
804
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
805 # determine standard deviation of quantile to impute
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
806 sd_finite <- function(x) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
807 ok <- is.finite(x)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
808 sd(x[ok])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
809 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
810
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
811 # compute anova raw p-value
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
812 anova_func <- function(x, grouping_factor, one_way_f) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
813 subject <- data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
814 intensity = x
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
815 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
816 x_aov <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
817 one_way_f(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
818 formula = intensity ~ grouping_factor,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
819 data = subject
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
820 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
821 pvalue <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
822 if (identical(one_way_f, aov))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
823 summary(x_aov)[[1]][["Pr(>F)"]][1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
824 else
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
825 pvalue <- x_aov$p.value
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
826 pvalue
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
827 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
828
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
829 # This code adapted from matrixcalc::is.positive.definite
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
830 # Notably, this simply tests without calling stop()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
831 is_positive_definite <- function(x, tol = 1e-08) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
832 if (!is.matrix(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
833 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
834 if (!is.numeric(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
835 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
836 if (nrow(x) < 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
837 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
838 if (ncol(x) < 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
839 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
840 if (nrow(x) != ncol(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
841 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
842 sum_symm <- sum(x == t(x), na.rm = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
843 value_count <- Reduce("*", dim(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
844 if (sum_symm != value_count)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
845 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
846 eigenvalues <- eigen(x, only.values = TRUE)$values
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
847 n <- nrow(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
848 for (i in 1:n) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
849 if (abs(eigenvalues[i]) < tol) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
850 eigenvalues[i] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
851 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
852 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
853 if (any(eigenvalues <= 0)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
854 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
855 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
856 return(TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
857 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
858
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
859 ### LaTeX functions
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
860
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
861 # Use this like print.data.frame, from which it is adapted:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
862 data_frame_table_latex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
863 function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
864 x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
865 # digits to pass to format.data.frame
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
866 digits = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
867 # TRUE -> right-justify columns; FALSE -> left-justify
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
868 right = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
869 # maximumn number of rows to print
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
870 max = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
871 # string with justification of each column
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
872 justification = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
873 # TRUE to center on page
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
874 centered = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
875 # optional caption
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
876 caption = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
877 # h(inline); b(bottom); t (top) or p (separate page)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
878 anchor = "h",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
879 # set underscore_whack to TRUE to escape underscores
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
880 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
881 # how to emit results
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
882 emit = cat
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
883 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
884 if (is.null(justification))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
885 justification <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
886 Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
887 f = paste,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
888 x = rep_len(if (right) "r" else "l", length(colnames(x)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
889 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
890 n <- length(rownames(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
891 if (length(x) == 0L) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
892 emit(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
893 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
894 # if n is one, use singular 'row', else use plural 'rows'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
895 ngettext(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
896 n,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
897 "data frame with 0 columns and %d row",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
898 "data frame with 0 columns and %d rows"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
899 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
900 n
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
901 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
902 "\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
903 sep = ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
904 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
905 } else if (n == 0L) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
906 emit("0 rows for:\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
907 latex_itemized_list(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
908 v = names(x),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
909 underscore_whack = underscore_whack
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
910 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
911 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
912 if (is.null(max))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
913 max <- getOption("max.print", 99999L)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
914 if (!is.finite(max)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
915 cat("Abend because: invalid 'max' / getOption(\"max.print\"): ", max)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
916 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
917 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
918 omit <- (n0 <- max %/% length(x)) < n
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
919 m <- as.matrix(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
920 format.data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
921 if (omit) x[seq_len(n0), , drop = FALSE] else x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
922 digits = digits,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
923 na.encode = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
924 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
925 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
926 emit(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
927 # h(inline); b(bottom); t (top) or p (separate page)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
928 paste0("\\begin{table}[", anchor, "]"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
929 "\\leavevmode",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
930 sep = "\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
931 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
932 if (!is.null(caption))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
933 emit(paste0(" \\caption{", caption, "}"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
934 if (centered) emit("\\centering\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
935 emit(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
936 paste(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
937 " \\begin{tabular}{",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
938 justification,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
939 "}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
940 sep = ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
941 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
942 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
943
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
944 # ref for top and bottom struts (\T and \B):
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
945 # https://tex.stackexchange.com/a/50355
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
946 if (!is.null(caption))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
947 emit("\\B \\\\\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
948 latex_table_row(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
949 v = colnames(m),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
950 extra = " \\T \\B",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
951 underscore_whack = underscore_whack
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
952 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
953 emit("\\hline \\\\\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
954 for (i in seq_len(length(m[, 1]))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
955 latex_table_row(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
956 v = m[i, ],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
957 underscore_whack = underscore_whack
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
958 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
959 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
960 emit(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
961 paste(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
962 " \\end{tabular}",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
963 "\\end{table}",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
964 sep = "\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
965 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
966 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
967 if (omit)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
968 emit(" [ reached 'max' / getOption(\"max.print\") -- omitted",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
969 n - n0, "rows ]\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
970 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
971 invisible(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
972 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
973
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
974 # Use this like print.data.frame, from which it is adapted:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
975 data_frame_tabbing_latex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
976 function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
977 x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
978 # vector of tab stops, in inches
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
979 tabstops,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
980 # vector of headings, registered with tab-stops
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
981 headings = colnames(x),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
982 # digits to pass to format.data.frame
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
983 digits = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
984 # maximumn number of rows to print
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
985 max = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
986 # optional caption
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
987 caption = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
988 # set underscore_whack to TRUE to escape underscores
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
989 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
990 # flag for landscape mode
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
991 landscape = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
992 # flag indicating that subsubsection should be used for caption
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
993 # rather than subsection
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
994 use_subsubsection_header = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
995 # character-size indicator; for possible values, see:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
996 # https://tug.org/texinfohtml/latex2e.html#Font-sizes
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
997 charactersize = "small",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
998 # set verbatim to TRUE to debug output
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
999 verbatim = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1000 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1001
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1002 hlinport <- if (landscape) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1003 function() cat("\\hlinlscp \\\\\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1004 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1005 function() cat("\\hlinport \\\\\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1006 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1007
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1008 tabstops_tex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1009 Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1010 f = function(l, r) paste0(l, r),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1011 x = sprintf("\\hspace{%0.2fin}\\=", tabstops),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1012 init = ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1013 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1014
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1015 n <- length(rownames(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1016 if (length(x) == 0L) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1017 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1018 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1019 # if n is one, use singular 'row', else use plural 'rows'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1020 ngettext(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1021 n,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1022 "data frame with 0 columns and %d row",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1023 "data frame with 0 columns and %d rows"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1024 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1025 n
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1026 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1027 "\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1028 sep = ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1029 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1030 } else if (n == 0L) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1031 cat("0 rows for:\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1032 latex_itemized_list(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1033 v = names(x),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1034 underscore_whack = underscore_whack
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1035 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1036 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1037 if (is.null(max))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1038 max <- getOption("max.print", 99999L)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1039 if (!is.finite(max)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1040 cat("Abend because: invalid 'max' / getOption(\"max.print\"): ", max)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1041 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1042 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1043 omit <- (n0 <- max %/% length(x)) < n
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1044 m <- as.matrix(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1045 format.data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1046 if (omit) x[seq_len(n0), , drop = FALSE] else x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1047 digits = digits,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1048 na.encode = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1049 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1050 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1051 if (landscape)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1052 cat("\n\\begin{landscape}")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1053 tex_caption <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1054 if (!is.null(caption)) sprintf("\\captionof{table}{%s}\n", caption)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1055 else "\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1056 # build the column names, which have multiple lines when
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1057 # length(headings) is a multiple of the number of columns
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1058 column_names <- ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1059 while (length(headings) > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1060 my_row <- c()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1061 for (i in 1:(1 + length(tabstops))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1062 my_field <- sq_get(headings)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1063 sq_put(my_row, if (is.na(my_field)) "" else my_field)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1064 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1065 column_names %||:=% latex_tabbing_row(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1066 v = my_row,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1067 underscore_whack = underscore_whack,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1068 action = paste0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1069 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1070 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1071
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1072 # Begin tabbing environment after beginning charactersize environment
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1073 if (verbatim) cat("\n\\begin{verbatim}")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1074 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1075 paste0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1076 "\n\\begin{", charactersize, "}", tex_caption,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1077 "\\begin{tabwrap}{", tabstops_tex, "}\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1078 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1079 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1080 # emit column names
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1081 cat(column_names)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1082 # emit hline
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1083 hlinport()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1084 for (i in seq_len(length(m[, 1]))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1085 my_row <- latex_tabbing_row(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1086 v = m[i, ],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1087 underscore_whack = underscore_whack,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1088 action = paste0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1089 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1090 if (FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1091 cat(my_row)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1092 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1093 cat(my_row)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1094 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1095 hlinport()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1096 if (omit)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1097 cat(" [ reached 'max' / getOption(\"max.print\") -- omitted",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1098 n - n0, "rows ]\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1099 # End charactersize environment after ending tabbing environment
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1100 cat(paste0("\\end{tabwrap}\n\\end{", charactersize, "}\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1101 if (verbatim) cat("\\end{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1102 if (landscape)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1103 cat("\\end{landscape}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1104 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1105 invisible(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1106 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1107
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1108 param_df_noexit <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1109 function(e = NULL) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1110 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1111 x = param_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1112 tabstops = c(1.75),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1113 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1114 caption = "Input parameters",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1115 verbatim = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1116 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1117 if (!is.null(e)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1118 sink(stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1119 cat("Caught fatal error:\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1120 str(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1121 sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1122 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1123 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1124
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1125 param_df_exit <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1126 function(e = NULL) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1127 param_df_noexit(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1128 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1129 exit(-1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1130 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1131
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1132 # exit with exit code (default 0) and optional msg
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1133 exit <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1134 function(code = 0, msg = NULL, use_stderr = FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1135 if (!is.null(msg)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1136 if (use_stderr) sink(stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1137 cat("\n\n", msg, "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1138 if (use_stderr) sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1139 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1140 q(save = "no", status = code)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1141 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1142
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1143 # make control sequences into printable latex sequences
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1144 latex_printable_control_seqs <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1145 function(s) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1146 s <- gsub("[\\]", "xyzzy_plugh", s)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1147 s <- gsub("[$]", "\\\\$", s)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1148 s <- gsub("xyzzy_plugh", "$\\\\backslash$", s)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1149 return(s)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1150 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1151 nolatex_verbatim <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1152 function(expr) eval(expr)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1153
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1154 latex_verbatim <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1155 function(expr) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1156 arg_string <- deparse1(substitute(expr))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1157 cat("\n\\begin{verbatim}\n___\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1158 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1159 expr = expr,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1160 error = param_df_exit,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1161 #ACE error =
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1162 #ACE function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1163 #ACE cat("Caught error:\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1164 #ACE str(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1165 #ACE knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1166 #ACE stop(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1167 #ACE },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1168 finally = cat("...\n\\end{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1169 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1170 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1171
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1172 latex_samepage <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1173 function(expr) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1174 arg_string <- deparse1(substitute(expr))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1175 cat("\n\\begin{samepage}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1176 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1177 expr = expr,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1178 error = param_df_exit,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1179 #ACE error =
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1180 #ACE function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1181 #ACE cat("Caught error:\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1182 #ACE str(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1183 #ACE knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1184 #ACE stop(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1185 #ACE },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1186 finally = cat("\n\\end{samepage}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1187 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1188 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1189
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1190 # return the result of invocation after showing parameters
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1191 # ref: https://www.r-bloggers.com/2013/08/a-new-r-trick-for-me-at-least/
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1192 latex_show_invocation <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1193 function(f, f_name = deparse1(substitute(f)), head_patch = FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1194 function(...) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1195 my_env <- (as.list(environment()))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1196 va <- list(...)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1197 my_rslt <- new_env()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1198 my_rslt$rslt <- NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1199 latex_verbatim(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1200 expr = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1201 cat(sprintf("\n .. Local variables for '%s':\n\n", f_name))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1202 str(va)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1203 if (!head_patch) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1204 # return this result
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1205 # ref: https://www.r-bloggers.com/2013/08/a-new-r-trick-for-me-at-least/
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1206 cat(sprintf("\n .. Invoking '%s'\n", f_name))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1207 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1208 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1209 cat("\n\\end{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1210 rslt <- do.call(f, va)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1211 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1212 error = param_df_exit,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1213 #ACE error = function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1214 #ACE cat("\n\\begin{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1215 #ACE str(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1216 #ACE cat("\n\\end{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1217 #ACE knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1218 #ACE stop(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1219 #ACE },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1220 finally = cat("\n\\begin{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1221 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1222 cat(sprintf("\n .. '%s' returned:\n", f_name))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1223 str(rslt)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1224 my_rslt$rslt <- rslt
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1225 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1226 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1227 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1228 # return the result of invocation with the shown parameters
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1229 # ref: https://www.r-bloggers.com/2013/08/a-new-r-trick-for-me-at-least/
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1230 if (head_patch) my_rslt$rslt <- do.call(f, va)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1231 (my_rslt$rslt)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1232 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1233 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1234
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1235 latex_collapsed_vector <- function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1236 collapse_string,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1237 v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1238 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1239 action = cat0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1240 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1241 v_sub <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1242 if (underscore_whack) whack_underscores(v) else v
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1243 action(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1244 paste0(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1245 v_sub,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1246 collapse = collapse_string
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1247 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1248 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1249 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1250
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1251 latex_itemized_collapsed <- function(collapse_string, v, underscore_whack = TRUE) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1252 cat("\\begin{itemize}\n\\item ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1253 latex_collapsed_vector(collapse_string, v, underscore_whack)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1254 cat("\n\\end{itemize}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1255 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1256
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1257 latex_itemized_list <- function(v, underscore_whack = TRUE) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1258 latex_itemized_collapsed("\n\\item ", v, underscore_whack)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1259 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1260
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1261 latex_enumerated_collapsed <- function(collapse_string, v, underscore_whack = TRUE) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1262 cat("\\begin{enumerate}\n\\item ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1263 latex_collapsed_vector(collapse_string, v, underscore_whack)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1264 cat("\n\\end{enumerate}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1265 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1266
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1267 latex_enumerated_list <- function(v) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1268 latex_enumerated_collapsed("\n\\item ", v)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1269 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1270
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1271 latex_table_row <- function(v, extra = "", underscore_whack = TRUE) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1272 latex_collapsed_vector(" & ", v, underscore_whack)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1273 cat(extra)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1274 cat(" \\\\\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1275 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1276
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1277 latex_tabbing_row <- function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1278 v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1279 extra = "",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1280 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1281 action = cat0
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1282 ) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1283 # latex_collapsed_vector applies action to result of paste0;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1284 # by default, action = cat;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1285 # hence, a scalar string is assigned to v_collapsed
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1286 v_collapsed <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1287 latex_collapsed_vector(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1288 "} \\> \\tabfill{",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1289 v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1290 underscore_whack,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1291 action = paste0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1292 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1293 action(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1294 "\\tabfill{",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1295 v_collapsed,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1296 "}",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1297 extra,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1298 " \\\\\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1299 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1300 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1301
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1302 # N.B. use con = "" to emulate regular cat
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1303 fcat0 <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1304 function(..., sprtr = " ", cnnctn = file()) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1305 cat0(..., sep = sprtr, file = cnnctn)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1306 invisible(cnnctn)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1307 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1308
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1309 hypersub <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1310 function(s) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1311 hyper <- tolower(s)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1312 hyper <- gsub("[^a-z0-9]+", "-", hyper)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1313 hyper <- gsub("[-]+", "-", hyper)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1314 hyper <- gsub("[_]+", "-", hyper)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1315 hyper <- sub("^[-]", "", hyper)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1316 hyper <- sub("[-]$", "", hyper)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1317 return(hyper)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1318 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1319
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1320 table_href <- function(s = "offset", caption = "") {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1321 paste0("\\hyperlink{table.\\arabic{", s, "}}{Table \\arabic{", s, "}}")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1322 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1323
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1324 table_offset <- function(i = 0, s = "offset", new = FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1325 paste0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1326 if (new) paste0("\\newcounter{", s, "}\n") else "",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1327 "\\setcounter{", s, "}{\\value{table}}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1328 paste0(if (i > 0) rep(paste0("\\stepcounter{", s, "}"), i), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1329 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1330 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1331
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1332 a_section_header <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1333 function(s, prefix = "") {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1334 hyper <- hypersub(s)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1335 my_subsection_header <- sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1336 "\\hypertarget{%s}{\\%ssection{%s}\\label{%s}}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1337 hyper,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1338 prefix,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1339 gsub("_", "\\_", s, fixed = TRUE),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1340 hyper
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1341 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1342 my_subsection_header
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1343 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1344 section_header <- function(s) a_section_header(s, "")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1345 subsection_header <- function(s) a_section_header(s, "sub")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1346 subsubsection_header <- function(s) a_section_header(s, "subsub")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1347
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1348 ### SQLite functions
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1349
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1350 ddl_exec <- function(db, sql) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1351 discard <- DBI::dbExecute(conn = db, statement = sql)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1352 if (FALSE && discard != 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1353 need_newpage <- TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1354 if (need_newpage) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1355 need_newpage <<- FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1356 cat("\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1357 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1358 o_file <- stdout()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1359 cat("\n\\begin{verbatim}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1360 cat(sql, file = o_file)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1361 cat(sprintf("\n%d rows affected by DDL\n", discard), file = o_file)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1362 cat("\n\\end{verbatim}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1363 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1364 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1365
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1366 dml_no_rows_exec <- function(db, sql) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1367 discard <- DBI::dbExecute(conn = db, statement = sql)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1368 if (discard != 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1369 need_newpage <- TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1370 if (need_newpage) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1371 need_newpage <<- FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1372 cat("\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1373 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1374 cat("\n\\begin{verbatim}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1375 o_file <- stdout()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1376 cat(sql, file = o_file)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1377 cat(sprintf("\n%d rows affected by DML\n", discard), file = o_file)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1378 cat("\n\\end{verbatim}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1379 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1380 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1381
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1382 ### KSEA functions and helpers
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1383
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1384 #' The KSEA App Analysis (KSEA Kinase Scores Only)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1385 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1386 #' Compute KSEA kinase scores and statistics from phoshoproteomics data input
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1387 #' Adapted from KSEAapp::KSEA.Scores to allow retrieval of maximum log2(FC)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1388 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1389 #' Result is an R data.frame with column names
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1390 #' "Kinase.Gene", "mS", "Enrichment", "m", "z.score", "p.value", "FDR"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1391 #' "Please refer to the original Casado et al. publication for detailed
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1392 #' description of these columns and what they represent:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1393 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1394 #' - Kinase.Gene indicates the gene name for each kinase.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1395 #' - mS represents the mean log2(fold change) of all the
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1396 #' kinase's substrates.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1397 #' - Enrichment is the background-adjusted value of the kinase's mS.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1398 #' - m is the total number of detected substrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1399 #' from the experimental dataset for each kinase.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1400 #' - z.score is the normalized score for each kinase, weighted by
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1401 #' the number of identified substrates.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1402 #' - p.value represents the statistical assessment for the z.score.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1403 #' - FDR is the p-value adjusted for multiple hypothesis testing
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1404 #' using the Benjamini & Hochberg method."
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1405 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1406 #' @param ksdata the Kinase-Substrate dataset uploaded from the file
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1407 #' prefaced with "PSP&NetworKIN_"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1408 #' available from github.com/casecpb/KSEA/
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1409 #' @param px the experimental data file formatted as described in
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1410 #' the KSEA.Complete() documentation
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1411 #' @param networkin a binary input of TRUE or FALSE, indicating whether
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1412 #' or not to include NetworKIN predictions, where
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1413 #' \code{NetworKIN = TRUE}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1414 #' means include NetworKIN predictions
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1415 #' @param networkin_cutoff a numeric value between 1 and infinity setting
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1416 #' the minimum NetworKIN score
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1417 #' (this can be omitted if NetworKIN = FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1418 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1419 #' @return creates a new R data.frame with all the KSEA kinase
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1420 #' scores, along with each one's statistical
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1421 #' assessment, as described herein.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1422 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1423 #' @references
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1424 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1425 #' Casado et al. (2013) Sci Signal. 6(268):rs6
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1426 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1427 #' Hornbeck et al. (2015) Nucleic Acids Res. 43:D512-20
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1428 #'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1429 #' Horn et al. (2014) Nature Methods 11(6):603-4
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1430 #'
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1431 ksea_scores <- function(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1432 # For human data, typically, ksdata = KSEAapp::ksdata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1433 ksdata,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1434
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1435 # Input data file having columns:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1436 # - Protein : abbreviated protein name
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1437 # - Gene : HUGO gene name
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1438 # - Peptide : peptide sequence without indications of phosphorylation
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1439 # - Reside.Both : position(s) of phosphorylation within Gene sequence
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1440 # - First letter designates AA that is modified
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1441 # - Numbers indicate position within Gene
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1442 # - Multiple values are separated by semicolons
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1443 # - p : p-value
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1444 # - FC : fold-change
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1445 px,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1446
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1447 # A binary input of TRUE or FALSE, indicating whether or not to include
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1448 # NetworKIN predictions
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1449 networkin,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1450
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1451 # A numeric value between 1 and infinity setting the minimum NetworKIN
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1452 # score (can be left out if networkin = FALSE)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1453 networkin_cutoff,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1454
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1455 # Minimum substrate count, necessary to adjust the p-value appropriately.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1456 minimum_substrate_count
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1457
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1458 ) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1459 # no px$FC should be <= 0, but abs(px$FC) is used below as a precaution.
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1460 if (length(grep(";", px$Residue.Both)) == 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1461 # There are no Residue.Both entries having semicolons, so new is
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1462 # simply px except two columns are renamed and a column is added
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1463 # for log2(abs(fold-change))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1464 new <- px
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1465 colnames(new)[c(2, 4)] <- c("SUB_GENE", "SUB_MOD_RSD")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1466 new$log2_fc <- log2(abs(as.numeric(as.character(new$FC))))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1467 new <- new[complete.cases(new$log2_fc), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1468 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1469 # Split each row having semicolons in Residue.Both into rows that are
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1470 # duplicated in all respects except that each row has a single
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1471 # member of the set "split-on-semicolon-Residue.Both"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1472 px_double <- px[grep(";", px$Residue.Both), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1473 residues <- as.character(px_double$Residue.Both)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1474 residues <- as.matrix(residues, ncol = 1)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1475 split <- strsplit(residues, split = ";")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1476 # x gets count of residues in each row,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1477 # i.e., 1 + count of semicolons
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1478 x <- sapply(split, length)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1479 # Here is the set of split rows
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1480 px_single <- data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1481 Protein = rep(px_double$Protein, x),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1482 Gene = rep(px_double$Gene, x),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1483 Peptide = rep(px_double$Peptide, x),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1484 Residue.Both = unlist(split),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1485 p = rep(px_double$p, x),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1486 FC = rep(px_double$FC, x)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1487 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1488 # new first gets the split rows
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1489 new <- px[-grep(";", px$Residue.Both), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1490 # to new, append the rows that didn't need splitting in the first place
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1491 new <- rbind(new, px_single)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1492 # map Gene to SUB_GENE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1493 # map Residue.Both to SUB_MOD_RSD
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1494 colnames(new)[c(2, 4)] <- c("SUB_GENE", "SUB_MOD_RSD")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1495 # Eliminate any non-positive values to prevent introduction of
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1496 # infinite or NaN values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1497 new[(0 <= new$log2_fc), "log2_fc"] <- NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1498 # Because of preceding step, there is no need for abs in the next line
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1499 new$log2_fc <- log2(as.numeric(as.character(new$FC)))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1500 # Convert any illegal values from NaN to NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1501 new[is.nan(new$log2_fc), "log2_fc"] <- NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1502 # Eliminate rows having missing values (e.g., non-imputed data)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1503 new <- new[complete.cases(new$log2_fc), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1504 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1505 # At this point, new$log2_fc is signed according to which contrast has
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1506 # the greater intensity
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1507 # To take the magnitude into account without taking the direction into
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1508 # account, set params$kseaUseAbsoluteLog2FC to TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1509 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1510 # Should KSEA be performed aggregating signed log2FC or absolute?
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1511 # FALSE use raw log2FC for KSEA as for KSEAapp::KSEA.Scores
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1512 if (params$kseaUseAbsoluteLog2FC) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1513 # TRUE use abs(log2FC) for KSEA as Justin requested; this is a
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1514 # justifiable deviation from the KSEAapp::KSEA.Scores algorithm.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1515 new$log2_fc <- abs(new$log2_fc)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1516 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1517
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1518 monitor_filtration_on_stderr <- TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1519 if (monitor_filtration_on_stderr) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1520 # set to TRUE to monitor filtration on stderr
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1521 sink(stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1522 cat(see_variable(networkin, "\n"))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1523 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1524 ksdata_filtered <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1525 sqldf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1526 sprintf("%s %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1527 "select * from ksdata where not Source = 'NetworKIN'",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1528 if (networkin)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1529 sprintf("or networkin_score >= %d", networkin_cutoff)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1530 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1531 ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1532 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1533 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1534 if (monitor_filtration_on_stderr) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1535 cat(see_variable(sqldf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1536 "select count(*), Source from ksdata group by Source"), "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1537 cat(see_variable(sqldf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1538 "select count(*), Source from ksdata_filtered group by Source"), "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1539 sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1540 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1541
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1542 ############################################################################
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1543 # Line numbers below refer to lines of:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1544 # https://github.com/casecpb/KSEAapp/blob/master/R/KSEA.Scores.R
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1545 # I would put the original line in a comment but then lint would complain...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1546 # - Indeed, I had to rename all the variables because lint didn't like names
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1547 # containing periods or capital letters.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1548 # ACE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1549 ############################################################################
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1550 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1551 # (1) Join the two data.frames on common columns SUB_GENE and SUB_MOD_RSD
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1552 # colnames of ksdata_filtered:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1553 # "KINASE" "KIN_ACC_ID" "GENE" "KIN_ORGANISM" "SUBSTRATE" "SUB_GENE_ID"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1554 # "SUB_ACC_ID" "SUB_GENE" "SUB_ORGANISM" "SUB_MOD_RSD" "SITE_GRP_ID"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1555 # "SITE_...7_AA" "networkin_score" "Source"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1556 # colnames of new:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1557 # "Protein" "SUB_GENE" "Peptide" "SUB_MOD_RSD" "p" "FC" "log2_fc"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1558 # Equivalent to:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1559 # SELECT a.*. b.Protein, b.Peptide, b.p, b.FC, b.log2_fc
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1560 # FROM ksdata_filtered a
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1561 # INNER JOIN new b
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1562 # ON a.SUB_GENE = b.SUB_GENE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1563 # AND a.SUB_MOD_RSD = b.SUB_MOD_RSD
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1564 # (KSEA.Scores.R line # 105)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1565 # "Extract KSData.filtered annotations that are only found in new"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1566 ksdata_dataset <- base::merge(ksdata_filtered, new)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1567 # colnames of ksdata_dataset:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1568 # "KINASE" "KIN_ACC_ID" "GENE" "KIN_ORGANISM" "SUBSTRATE"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1569 # "SUB_GENE_ID" "SUB_ACC_ID" "SUB_GENE" "SUB_ORGANISM" "SUB_MOD_RSD"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1570 # "SITE_GRP_ID" "SITE_...7_AA" "networkin_score" "Source" "Protein"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1571 # "Peptide" "p" "FC" "log2_fc" (uniprot_no_isoform)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1572 # Re-order dataset; prior to accounting for isoforms
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1573 # (KSEA.Scores.R line # 106)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1574 ksdata_dataset <- ksdata_dataset[order(ksdata_dataset$GENE), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1575 # Extract non-isoform accession in UniProtKB
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1576 # (KSEA.Scores.R line # 107)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1577 ksdata_dataset$uniprot_no_isoform <- sapply(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1578 ksdata_dataset$KIN_ACC_ID,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1579 function(x) unlist(strsplit(as.character(x), split = "-"))[1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1580 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1581 # "last expression collapses isoforms ... for easy processing"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1582 # Discard previous results while selecting interesting columns ...
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1583 # (KSEA.Scores.R line # 110)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1584 ksdata_dataset_abbrev <- ksdata_dataset[, c(5, 1, 2, 16:19, 14)]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1585 # Column names are now:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1586 # "GENE" "SUB_GENE" "SUB_MOD_RSD" "Peptide" "p"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1587 # "FC" "log2_fc" "Source"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1588 # Make column names human-readable
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1589 # (KSEA.Scores.R line # 111)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1590 colnames(ksdata_dataset_abbrev) <- c(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1591 "Kinase.Gene", "Substrate.Gene", "Substrate.Mod", "Peptide", "p",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1592 "FC", "log2FC", "Source"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1593 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1594 # SELECT * FROM ksdata_dataset_abbrev
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1595 # ORDER BY Kinase.Gene, Substrate.Gene, Substrate.Mod, p
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1596 # (KSEA.Scores.R line # 112)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1597 # "Extract KSData.filtered annotations that are only found in new"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1598 ksdata_dataset_abbrev <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1599 ksdata_dataset_abbrev[
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1600 order(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1601 ksdata_dataset_abbrev$Kinase.Gene,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1602 ksdata_dataset_abbrev$Substrate.Gene,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1603 ksdata_dataset_abbrev$Substrate.Mod,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1604 ksdata_dataset_abbrev$p),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1605 ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1606 if (print_nb_messages) nbe(see_variable(ksdata_dataset_abbrev))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1607 # First aggregation step to account for multiply phosphorylated peptides
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1608 # and differing peptide sequences; the goal here is to combine results
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1609 # for all measurements of the same substrate.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1610 # SELECT `Kinase.Gene`, `Substrate.Gene`, `Substrate.Mod`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1611 # `Source`, avg(log2FC) AS log2FC
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1612 # FROM ksdata_dataset_abbrev
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1613 # GROUP BY `Kinase.Gene`, `Substrate.Gene`, `Substrate.Mod`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1614 # `Source`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1615 # ORDER BY `Kinase.Gene`;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1616 # in two steps:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1617 # (1) compute average log_2(fold-change)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1618 # "take the mean of the log2FC amongst phosphosite duplicates"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1619 # (KSEA.Scores.R line # 115)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1620 ksdata_dataset_abbrev <- aggregate(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1621 log2FC ~ Kinase.Gene + Substrate.Gene + Substrate.Mod + Source,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1622 data = ksdata_dataset_abbrev,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1623 FUN = mean
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1624 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1625 if (print_nb_messages) nbe(see_variable(ksdata_dataset_abbrev))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1626 # (2) order by Kinase.Gene
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1627 # (KSEA.Scores.R line # 117)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1628 ksdata_dataset_abbrev <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1629 ksdata_dataset_abbrev[order(ksdata_dataset_abbrev$Kinase.Gene), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1630 # SELECT `Kinase.Gene`, count(*)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1631 # FROM ksdata_dataset_abbrev
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1632 # GROUP BY `Kinase.Gene`;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1633 # in two steps:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1634 # (1) Extract the list of Kinase.Gene names
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1635 # "@@@@@@@@@@@@@@@@@@@@"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1636 # "Do analysis for KSEA"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1637 # "@@@@@@@@@@@@@@@@@@@@"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1638 # (KSEA.Scores.R line # 124)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1639 kinase_list <- as.vector(ksdata_dataset_abbrev$Kinase.Gene)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1640 # (2) Convert to a named list of counts of kinases in ksdata_dataset_abrev,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1641 # named by Kinase.Gene
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1642 # (KSEA.Scores.R line # 125)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1643 kinase_list <- as.matrix(table(kinase_list))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1644 # Second aggregation step to account for all substrates per kinase
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1645 # CREATE TABLE mean_fc
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1646 # AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1647 # SELECT `Kinase.Gene`, avg(log2FC) AS log2FC
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1648 # FROM ksdata_dataset_abbrev
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1649 # GROUP BY `Kinase.Gene`
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1650 # (KSEA.Scores.R line # 127)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1651 if (print_nb_messages) nb(see_variable(ksdata_dataset_abbrev), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1652 mean_fc <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1653 aggregate(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1654 log2FC ~ Kinase.Gene,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1655 data = ksdata_dataset_abbrev,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1656 FUN = mean
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1657 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1658 if (print_nb_messages) nbe(see_variable(mean_fc), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1659
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1660 # for contrast j
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1661 # for each kinase i
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1662 # extract log2 of fold-change (from `new` above)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1663 # (used in KSEA.Scores.R lines # 130 & 132)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1664 log2_fc_j_each_i <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1665 new$log2_fc
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1666
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1667 # for contrast j
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1668 # for all kinases i
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1669 # compute mean of abs(log2 of fold-change)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1670 # (used in KSEA.Scores.R lines # 130)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1671 mean_abs_log2_fc_j_all_i <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1672 mean(abs(log2_fc_j_each_i), na.rm = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1673
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1674 # for contrast j
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1675 # for all kinases i
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1676 # compute mean of log2 of fold-change
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1677 # (used in KSEA.Scores.R lines # 132)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1678 mean_log2_fc_j_all_i <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1679 mean(log2_fc_j_each_i, na.rm = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1680
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1681 # Reorder mean_fc, although I don't see why
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1682 # (KSEA.Scores.R line 128
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1683 mean_fc <- mean_fc[order(mean_fc[, 1]), ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1684 # mean_fc columns so far: "Kinase.Gene", "log2FC"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1685 # - Kinase.Gene
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1686 # indicates the gene name for each kinase.
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1687
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1688 # Create column 3: mS
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1689 # - mS
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1690 # represents the mean log2(fold change) of all the
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1691 # kinase's substrates.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1692 # (KSEA.Scores.R line # 129)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1693 mean_fc$m_s <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1694 mean_fc_m_s <- mean_fc[, 2]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1695
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1696 # Create column 4: Enrichment
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1697 # - Enrichment
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1698 # is the background-adjusted value of the kinase's mS.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1699 # (KSEA.Scores.R line # 130)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1700 mean_fc$enrichment <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1701 mean_fc_m_s / mean_abs_log2_fc_j_all_i
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1702
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1703 # Create column 5: m, count of substrates of kinase (count of j for i)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1704 # - m
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1705 # is the total number of detected substrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1706 # from the experimental dataset for each kinase.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1707 # (KSEA.Scores.R line # 131)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1708 mean_fc$m <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1709 mean_fc_m <- kinase_list
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1710
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1711
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1712 # Create column 6: z-score
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1713 # - z.score
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1714 # is the normalized score for each kinase, weighted by
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1715 # the number of identified substrates.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1716 # (KSEA.Scores.R line # 132)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1717 mean_fc$z_score <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1718 (mean_fc_m_s - mean_log2_fc_j_all_i) * sqrt(mean_fc_m) /
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1719 sd(log2_fc_j_each_i, na.rm = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1720
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1721 # Create column 7: p-value, deduced from z-score
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1722 # - p.value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1723 # represents the statistical assessment for the z.score.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1724 # (KSEA.Scores.R line # 133)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1725 # "one-tailed p-value"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1726 mean_fc$p_value <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1727 pnorm(-abs(mean_fc$z_score))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1728
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1729 # zap excluded kinases; this must be done before adjusting p-value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1730 if (TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1731 mean_fc <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1732 mean_fc[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1733 mean_fc$m >= minimum_substrate_count,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1734 ,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1735 drop = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1736 ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1737 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1738
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1739 #ACE nb(see_variable(nrow(mean_fc)), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1740 # Create column 8: FDR, deduced by Benjamini-Hochberg adustment from p-value
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1741 # - FDR
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1742 # is the p-value adjusted for multiple hypothesis testing
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1743 # using the Benjamini & Hochberg method."
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1744 # (KSEA.Scores.R line # 134)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1745 mean_fc$fdr <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1746 p.adjust(mean_fc$p_value, method = "fdr")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1747
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1748 # It makes no sense to leave Z-scores negative when using
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1749 # absolute value of fold-change
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1750 if (params$kseaUseAbsoluteLog2FC) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1751 mean_fc$z_score <- abs(mean_fc$z_score)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1752 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1753
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1754 # Remove second column (log2FC), which is duplicated as mS
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1755 # (KSEA.Scores.R line # 136)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1756 mean_fc <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1757 mean_fc[order(mean_fc$Kinase.Gene), -2]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1758 # Correct the column names which we had to hack because of the linter...
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1759 colnames(mean_fc) <- c(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1760 "Kinase.Gene", "mS", "Enrichment", "m", "z.score", "p.value", "FDR"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1761 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1762 # (KSEA.Scores.R line # 138)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1763 return(mean_fc)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1764 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1765
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1766 ksea_low_fdr_barplot_factory <- function(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1767 rslt,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1768 i_cntrst,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1769 i,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1770 a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1771 b_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1772 fold_change,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1773 caption
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1774 ) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1775 rslt_score_list_i <- rslt$score_list[[i]]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1776 if (!is.null(rslt_score_list_i)) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1777 rslt_score_list_i_nrow <- nrow(rslt_score_list_i)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1778 k <- data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1779 contrast = as.integer(i_cntrst),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1780 a_level = rep.int(a_level, rslt_score_list_i_nrow),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1781 b_level = rep.int(b_level, rslt_score_list_i_nrow),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1782 kinase_gene = rslt_score_list_i$Kinase.Gene,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1783 mean_log2_fc = rslt_score_list_i$mS,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1784 enrichment = rslt_score_list_i$Enrichment,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1785 substrate_count = rslt_score_list_i$m,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1786 z_score = rslt_score_list_i$z.score,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1787 p_value = rslt_score_list_i$p.value,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1788 fdr = rslt_score_list_i$FDR
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1789 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1790 selector <- switch(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1791 ksea_cutoff_statistic,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1792 "FDR" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1793 k$fdr
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1794 },
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1795 "p.value" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1796 k$p_value
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1797 },
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1798 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1799 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1800 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1801 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1802 ksea_cutoff_statistic
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1803 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1804 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1805 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1806 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1807 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1808 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1809
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1810 k <- k[selector < ksea_cutoff_threshold, ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1811 nrow_k <- nrow(k)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1812
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1813 #ACE nbe(see_variable(fdr_barplot_dataframe <- k))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1814
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1815 if (nrow_k > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1816 max_nchar_rowname <- max(nchar(rownames(k)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1817 my_cex_names <- 1.0 / (1 + nrow_k / 50)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1818
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1819 if (print_trace_messages) cat_margins("Initially")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1820 if (print_trace_messages) cat_variable(nrow_k, "\n\n", 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1821 if (print_trace_messages) cat_variable(my_cex_names, "\n\n", 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1822 if (print_trace_messages) cat_variable(max_nchar_rowname, "\n\n", 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1823
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1824 # fin: The figure region dimensions, (width, height), in inches.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1825 # mar: A numerical vector of the form c(bottom, left, top, right)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1826 # that gives the number of lines of margin to be specified
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1827 # on the four sides of the plot; default: c(5, 4, 4, 2) + 0.1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1828
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1829 # mar: The figure region dimensions, (width, height), in inches.
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1830 numeric_z_score <- as.numeric(k$z_score)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1831 bar_order <- order(-as.numeric(k$p_value))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1832 kinase_name <- k$kinase_gene
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1833 long_caption <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1834 sprintf(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1835 "Kinase z-score, %s, KSEA %s < %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1836 caption,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1837 ksea_cutoff_statistic,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1838 ksea_cutoff_threshold
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1839 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1840 my_cex_caption <- 65.0 / max(65.0, nchar(long_caption))
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1841 # return a function that draws the plot
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1842 function() {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1843 par_fin <- par("fin") # vector of width_in_inches and height_in_inches)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1844 op <- par(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1845 bg = if (print_trace_messages) "yellow" else "white",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1846 fin = c(par_fin[1], min(par_fin[2], 2.5 + nrow_k / 6)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1847 mar = par("mar") +
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1848 c(3 / nrow_k, (1 + max_nchar_rowname * my_cex_names) / 2, 0, 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1849 # bottom, left, top, right
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1850 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1851 on.exit(par(op))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1852 if (print_trace_messages) cat_margins("Eventually")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1853
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1854 barplot(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1855 height = numeric_z_score[bar_order],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1856 border = NA,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1857 xpd = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1858 cex.names = my_cex_names,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1859 main = long_caption,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1860 cex.main = my_cex_caption,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1861 names.arg = kinase_name[bar_order],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1862 horiz = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1863 srt = 45,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1864 las = 1,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1865 cex.axis = 0.9
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1866 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1867 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1868 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1869 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1870 no_op
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1871 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1872 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1873
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1874 # note that this adds elements to the global variable `ksea_asterisk_hash`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1875
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1876 ksea_low_fdr_print <- function(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1877 rslt,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1878 i_cntrst,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1879 i,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1880 a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1881 b_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1882 fold_change,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1883 caption,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1884 write_db = TRUE, # if TRUE, write to DB, else print table
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1885 anchor = c(const_table_anchor_p, const_table_anchor_t)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1886 ) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1887 rslt_score_list_i <- rslt$score_list[[i]]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1888 if (!is.null(rslt_score_list_i)) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1889 rslt_score_list_i_nrow <- nrow(rslt_score_list_i)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1890 k <- contrast_ksea_scores <- data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1891 contrast = as.integer(i_cntrst),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1892 a_level = rep.int(a_level, rslt_score_list_i_nrow),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1893 b_level = rep.int(b_level, rslt_score_list_i_nrow),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1894 kinase_gene = rslt_score_list_i$Kinase.Gene,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1895 mean_log2_fc = rslt_score_list_i$mS,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1896 enrichment = rslt_score_list_i$Enrichment,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1897 substrate_count = rslt_score_list_i$m,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1898 z_score = rslt_score_list_i$z.score,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1899 p_value = rslt_score_list_i$p.value,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1900 fdr = rslt_score_list_i$FDR
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1901 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1902
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1903 selector <- switch(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1904 ksea_cutoff_statistic,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1905 "FDR" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1906 k$fdr
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1907 },
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1908 "p.value" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1909 k$p_value
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1910 },
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1911 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1912 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1913 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1914 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1915 ksea_cutoff_statistic
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1916 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1917 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1918 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1919 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1920 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1921 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1922
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1923 k <- k[selector < ksea_cutoff_threshold, ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1924 # save kinase names to ksea_asterisk_hash
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1925 for (kinase_name in k$kinase_gene) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1926 ksea_asterisk_hash[[kinase_name]] <- 1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1927 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1928
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1929 if (write_db) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1930 db_write_table_overwrite <- (i_cntrst < 2)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1931 db_write_table_append <- !db_write_table_overwrite
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1932 RSQLite::dbWriteTable(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1933 conn = db,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1934 name = "contrast_ksea_scores",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1935 value = contrast_ksea_scores,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1936 append = db_write_table_append
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1937 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1938 ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1939 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1940 selector <- switch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1941 ksea_cutoff_statistic,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1942 "FDR" = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1943 contrast_ksea_scores$fdr
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1944 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1945 "p.value" = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1946 contrast_ksea_scores$p_value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1947 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1948 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1949 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1950 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1951 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1952 ksea_cutoff_statistic
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1953 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1954 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1955 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1956 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1957 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1958 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1959 if (print_nb_messages) nbe(see_variable(contrast_ksea_scores))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1960 output_df <- contrast_ksea_scores[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1961 selector < ksea_cutoff_threshold,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1962 c("kinase_gene", "mean_log2_fc", "enrichment", "substrate_count",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1963 "z_score", "p_value", "fdr")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1964 ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1965 output_df$kinase_gene <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1966 gsub(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1967 "_",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1968 "\\\\_",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1969 output_df$kinase_gene
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1970 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1971 colnames(output_df) <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1972 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1973 colnames(output_df)[1],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1974 colnames(output_df)[2],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1975 "enrichment",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1976 "m_s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1977 "z_score",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1978 "p_value",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1979 "fdr"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1980 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1981 #ACE output_order <- with(output_df, order(fdr))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1982 output_order <- with(output_df, order(p_value))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1983 output_df <- output_df[output_order, ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1984
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1985 output_df[, 2] <- sprintf("%0.3g", output_df[, 2])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1986 output_df$fdr <- sprintf("%0.4f", output_df$fdr)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1987 output_df$p_value <- sprintf("%0.2e", output_df$p_value)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1988 output_df$z_score <- sprintf("%0.2f", output_df$z_score)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1989 output_df$m_s <- sprintf("%d", output_df$m_s)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1990 output_df$enrichment <- sprintf("%0.3g", output_df$enrichment)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1991 output_ncol <- ncol(output_df)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1992 colnames(output_df) <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1993 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1994 "Kinase",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1995 "\\(\\overline{{\\lvert}\\log_2 (\\text{fold-change}){\\rvert}}\\)",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1996 "Enrichment",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1997 "Substrates",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1998 "z-score",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1999 "p-value",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2000 "FDR"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2001 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2002 selector <- switch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2003 ksea_cutoff_statistic,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2004 "FDR" = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2005 rslt$score_list[[i]]$FDR
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2006 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2007 "p.value" = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2008 rslt$score_list[[i]]$p.value
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2009 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2010 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2011 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2012 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2013 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2014 ksea_cutoff_statistic
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2015 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2016 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2017 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2018 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2019 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2020 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2021 if (sum(selector < ksea_cutoff_threshold) > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2022 if (print_nb_messages) nbe(see_variable(output_df))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2023 math_caption <- gsub("{", "\\{", caption, fixed = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2024 math_caption <- gsub("}", "\\}", math_caption, fixed = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2025 # with (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2026 # output_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2027 # )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2028 if (TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2029 output_df$Kinase <- whack_underscores(output_df$Kinase)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2030 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2031 x = output_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2032 # vector of tab stops, in inches
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2033 tabstops = c(1.0, 1.2, 1.0, 1.0, 1.0, 1.0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2034 # vector of headings, registered with tab-stops
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2035 headings = colnames(output_df),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2036 # digits to pass to format.data.frame
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2037 digits = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2038 # maximumn number of rows to print
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2039 max = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2040 # optional caption
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2041 caption = sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2042 "\\text{%s}, KSEA %s < %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2043 math_caption,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2044 ksea_cutoff_statistic,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2045 ksea_cutoff_threshold
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2046 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2047 # set underscore_whack to TRUE to escape underscores
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2048 underscore_whack = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2049 # flag for landscape mode
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2050 landscape = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2051 # flag indicating that subsubsection should be used for caption
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2052 # rather than subsection
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2053 use_subsubsection_header = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2054 # character-size indicator; for possible values, see:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2055 # https://tug.org/texinfohtml/latex2e.html#Font-sizes
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2056 charactersize = "small",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2057 # set verbatim to TRUE to debug output
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2058 verbatim = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2059 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2060 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2061 data_frame_table_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2062 x = output_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2063 justification = "l c c c c c c",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2064 centered = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2065 caption = sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2066 "\\text{%s}, KSEA %s < %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2067 math_caption,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2068 ksea_cutoff_statistic,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2069 ksea_cutoff_threshold
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2070 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2071 anchor = anchor,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2072 underscore_whack = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2073 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2074 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2075 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2076 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2077 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2078 "\\break
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2079 No kinases had
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2080 \\(\\text{KSEA %s}_\\text{enrichment} < %s\\)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2081 for contrast %s\\hfill\\break\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2082 ksea_cutoff_statistic,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2083 ksea_cutoff_threshold,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2084 caption
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2085 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2086 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2087 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2088 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2089 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2090 ""
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2091 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2092 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2093
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2094 # create_breaks is a helper for ksea_heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2095 create_breaks <- function(merged_scores) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2096 if (sum(!is.na(merged_scores)) < 2)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2097 return(NULL)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2098 if (min(merged_scores, na.rm = TRUE) < -1.6) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2099 breaks_neg <- seq(-1.6, 0, length.out = 30)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2100 breaks_neg <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2101 append(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2102 seq(min(merged_scores, na.rm = TRUE), -1.6, length.out = 10),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2103 breaks_neg
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2104 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2105 breaks_neg <- sort(unique(breaks_neg))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2106 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2107 breaks_neg <- seq(-1.6, 0, length.out = 30)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2108 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2109 if (max(merged_scores, na.rm = TRUE) > 1.6) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2110 breaks_pos <- seq(0, 1.6, length.out = 30)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2111 breaks_pos <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2112 append(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2113 breaks_pos,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2114 seq(1.6, max(merged_scores, na.rm = TRUE),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2115 length.out = 10)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2116 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2117 breaks_pos <- sort(unique(breaks_pos))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2118 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2119 breaks_pos <- seq(0, 1.6, length.out = 30)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2120 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2121 breaks_all <- unique(append(breaks_neg, breaks_pos))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2122 mycol_neg <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2123 gplots::colorpanel(n = length(breaks_neg),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2124 low = "blue",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2125 high = "white")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2126 mycol_pos <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2127 gplots::colorpanel(n = length(breaks_pos) - 1,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2128 low = "white",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2129 high = "red")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2130 mycol <- unique(append(mycol_neg, mycol_pos))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2131 color_breaks <- list(breaks_all, mycol)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2132 return(color_breaks)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2133 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2134
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2135 hm2plus <- function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2136 x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2137 mat = matrix(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2138 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2139 c(0, 4, 0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2140 c(0, 3, 3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2141 c(2, 1, 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2142 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2143 nrow = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2144 ncol = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2145 byrow = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2146 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2147 denwid = 0.5,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2148 denhgt = 0.15,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2149 widths = c(0.5, 2.5, 1.5),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2150 heights = c(0.4, 0.15, 3.95),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2151 divergent = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2152 notecol = "grey50",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2153 trace = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2154 margins = c(6, 20),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2155 srtcol = 90,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2156 srtrow = 0,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2157 density_info = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2158 key_xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2159 key_par = list(),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2160 hclustfun = hclust,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2161 ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2162 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2163
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2164 varargs <- list(...)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2165 if (FALSE) # this is to avoid commenting out code to pass linting...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2166 my_hm2 <- latex_show_invocation(heatmap.2, head_patch = FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2167 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2168 my_hm2 <- heatmap.2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2169
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2170 x <- as.matrix(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2171 if (sum(!is.na(x)) < 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2172 return(NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2173 color_count <- 1 + max(64, length(as.vector(x))) # 8 was not enough
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2174 break_count <- 1 + color_count
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2175 min_nonax <- min(x, na.rm = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2176 max_nonax <- max(x, na.rm = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2177 if (print_nb_messages) nb("within hm2plus", see_variable(divergent), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2178 if (divergent) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2179 zlim <- max(abs(min_nonax), abs(max_nonax))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2180 if (print_nb_messages) nb(see_variable(pre_zlim <- zlim, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2181 breaks <- (zlim) / (break_count:1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2182 if (print_nb_messages) nb(see_variable(breaks, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2183 breaks <- breaks - median(breaks)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2184 zlim <- c(-zlim, zlim)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2185 if (print_nb_messages) nb(see_variable(zlim, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2186 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2187 zlim <- max(abs(min_nonax), abs(max_nonax))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2188 if (print_nb_messages) nb(see_variable(pre_zlim <- zlim, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2189 breaks <- zlim / (break_count:1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2190 if (print_nb_messages) nb(see_variable(breaks, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2191 if (max_nonax < 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2192 breaks <- breaks - zlim
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2193 zlim <- c(-zlim, 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2194 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2195 zlim <- c(0, zlim)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2196 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2197 if (print_nb_messages) nb(see_variable(zlim, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2198 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2199 nonax <- x
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2200 nonax[is.na(x)] <- min_nonax
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2201 if (is.null(widths)) widths <- c(denwid, 4 - denwid, 1.5)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2202 if (is.null(heights)) heights <- c(0.4, denhgt, 4.0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2203 colors <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2204 if (divergent && min_nonax < 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2205 # divergent colors on both sides of zero
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2206 colorRampPalette(c("red", "white", "blue"))(color_count)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2207 } else if (divergent && min_nonax > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2208 # "divergent" colors > zero
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2209 colorRampPalette(c("white", "blue"))(color_count)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2210 } else if (divergent && max_nonax < 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2211 # "divergent" colors < zero
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2212 colorRampPalette(c("red", "white"))(color_count)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2213 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2214 # "non-divergent" colors including zero
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2215 hcl.colors(color_count, "YlOrRd", rev = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2216 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2217
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2218 #ACE if (print_nb_messages) nb("within hm2plus", see_variable(key_par), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2219 #ACE if (print_nb_messages) nb(see_variable(colors, "\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2220 #ACE key_par$col = colors
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2221 #ACE key_par$breaks = breaks
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2222
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2223 if (print_nb_messages) nb(see_variable(par(), "\n")) #ACE TODO remove me
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2224 if (print_nb_messages) cat("\\leavevmode\n\\linebreak\n") #ACE TODO remove me
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2225 suppressWarnings(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2226 my_hm2(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2227 x = x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2228 col = colors,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2229 #ACE symkey = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2230 density.info = density_info,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2231 srtCol = srtcol,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2232 srtRow = srtrow,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2233 margins = margins,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2234 lwid = widths,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2235 lhei = heights,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2236 key.title = NA,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2237 key.xlab = key_xlab,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2238 key.par = key_par,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2239 lmat = mat,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2240 notecol = notecol,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2241 trace = trace,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2242 bg = "yellow",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2243 hclustfun = hclustfun,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2244 #ACE breaks = breaks,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2245 oldstyle = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2246 ... # varargs
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2247 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2248 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2249 # implicitly returning value returned by heatmap.2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2250 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2251
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2252 # draw_kseaapp_summary_heatmap is a helper function for ksea_heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2253 draw_kseaapp_summary_heatmap <- function(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2254 x, # matrix with row/col names already formatted
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2255 sample_cluster, # a binary input of TRUE or FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2256 # indicating whether or not to perform
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2257 # hierarchical clustering of the sample columns
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2258 merged_asterisk, # matrix having dimensions of x, values "*" or ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2259 color_breaks, # breaks for color gradation, from create_breaks
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2260 # passed to `breaks` argument of `image`
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2261 margins = c(8, 15), # two integers setting the bottom and right margins
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2262 # to accommodate row and column labels
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2263 master_cex = 0.7, # basis for text sizes
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2264 ...
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2265 ) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2266 merged_scores <- x
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2267 if (!is.matrix(x)) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2268 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2269 paste0(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2270 "No plot because \\texttt{typeof(x)} is '",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2271 typeof(x),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2272 "' rather than 'matrix'.\n\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2273 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2274 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2275 cat_variable(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2276 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2277 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2278 if (print_trace_messages) cat(sprintf("master_cex = %03f\n\n", master_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2279 nrow_x <- nrow(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2280 ncol_x <- ncol(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2281 #if (nrow_x < 2) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2282 if (nrow_x < 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2283 cat("No plot because matrix has no rows.\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2284 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2285 } else if (nrow_x < 2) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2286 cat("No plot because matrix has one row. Matrix looks like this:\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2287 cat("\n\\begin{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2288 print(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2289 cat("\n\\end{verbatim}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2290 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2291 } else if (ncol_x < 2) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2292 cat("No plot because matrix x has ", ncol_x, " columns.\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2293 cat_variable(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2294 return(FALSE)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2295 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2296 max_nchar_rowname <- max(nchar(rownames(x)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2297 max_nchar_colname <- max(nchar(colnames(x)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2298 my_limit <- g_intensity_hm_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2299
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2300 my_row_cex_scale <- master_cex * 150 / nrow_x
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2301 #ACE row cex shrink hack begin
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2302 my_row_cex_scale <- master_cex * 150 / max(nrow_x, ncol_x)
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2303 #ACE row cex shrink hack end
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2304
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2305 my_col_cex_scale <- 3.0
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2306 #ACE col cex shrink hack begin
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2307 if (ncol_x > 40)
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2308 my_col_cex_scale <- 3.0 * 40 / ncol_x
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2309 #ACE col cex shrink hack end
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2310
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2311 my_asterisk_scale <- 0.4 * my_row_cex_scale
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2312 my_row_warp <- 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2313 my_note_warp <- 2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2314 my_row_warp <- 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2315 my_row_cex_asterisk <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2316 master_cex * my_row_warp * my_asterisk_scale
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2317
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2318
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2319 my_col_cex <- my_col_cex_scale * master_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2320 my_row_cex <- min(3.5 * my_row_cex_asterisk, my_col_cex)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2321 my_key_cex <- 1.286
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2322 my_hm2_cex <- 1 * master_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2323 my_offset <- (4.8 / (9 + nrow_x / 10)) - 0.4
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2324 if (print_trace_messages) cat(sprintf("nrow_x = %03f\n\n", nrow_x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2325 if (print_trace_messages) cat(sprintf("my_offset = %03f\n\n", my_offset))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2326 my_offset <- 0.05
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2327 if (print_trace_messages) cat(sprintf("my_offset = %03f\n\n", my_offset))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2328 my_scale <- 3.0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2329 if (ncol_x < 10 && nrow_x < 10)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2330 my_scale <- my_scale * 10 / (10 - nrow_x) * 10 / (10 - ncol_x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2331
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2332 my_heights <- c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2333 0.15,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2334 3.85 - my_offset,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2335 0.5 + my_offset
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2336 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2337 my_margins <- c(1, 1) +
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2338 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2339 margins[1] * 0.08 * max_nchar_colname * my_col_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2340 margins[2] * 0.04 * max_nchar_rowname * my_row_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2341 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2342
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2343 my_notecex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2344 my_scale *
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2345 min(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2346 1.1,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2347 my_row_cex_asterisk * my_note_warp,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2348 my_col_cex * my_note_warp
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2349 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2350
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2351 if (print_trace_messages) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2352 cat_variable(my_heights, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2353 cat_variable(my_margins, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2354 cat_variable(my_row_cex_scale, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2355 cat_variable(my_col_cex_scale, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2356 cat_variable(my_row_cex_asterisk, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2357 cat_variable(my_row_cex, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2358 cat_variable(my_col_cex, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2359 cat_variable(my_row_cex, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2360 cat_variable(my_col_cex, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2361 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2362
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2363 hm2plus(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2364 x = merged_scores,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2365 Colv = sample_cluster,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2366 cellnote = merged_asterisk,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2367 cex = my_hm2_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2368 cexCol = my_col_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2369 cexRow = my_row_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2370 denhgt = 0.15,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2371 density_info = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2372 denwid = 0.5,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2373 divergent = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2374 key_par = list(cex = my_key_cex),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2375 key_xlab = "Z-score",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2376 margins = my_margins,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2377 notecex = my_scale * min(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2378 1.5,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2379 my_row_cex_asterisk * my_note_warp,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2380 my_col_cex * my_note_warp
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2381 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2382 notecol = "white",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2383 scale = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2384 srtcol = 90,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2385 srtrow = 0,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2386 trace = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2387 mat = matrix(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2388 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2389 c(0, 3, 3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2390 c(2, 1, 1),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2391 c(0, 4, 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2392 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2393 nrow = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2394 ncol = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2395 byrow = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2396 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2397 widths = c(0.5, 3.1, 0.9),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2398 heights = my_heights,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2399 ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2400 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2401 return(TRUE)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2402 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2403
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2404 # function drawing heatmap of contrast fold-change for each kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2405 # adapted from KSEAapp::KSEA.Heatmap
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2406 ksea_heatmap <- function(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2407 # the data frame outputs from the KSEA.Scores() function, in list format
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2408 score_list,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2409 # a character vector of all the sample names for heatmap annotation:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2410 # - the names must be in the same order as the data in score_list
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2411 # - please avoid long names, as they may get cropped in the final image
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2412 sample_labels,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2413 # character string of either "p.value" or "FDR" indicating the data column
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2414 # to use for marking statistically significant scores
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2415 stats,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2416 # a numeric value between 0 and infinity indicating the min. number of
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2417 # substrates a kinase must have to be included in the heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2418 m_cutoff,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2419 # a numeric value between 0 and 1 indicating the p-value/FDR cutoff
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2420 # for indicating significant kinases in the heatmap
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2421 p_cutoff = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2422 cat("argument 'p_cutoff' is required for function 'ksea_heatmap'")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2423 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2424 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2425 },
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2426 # a binary input of TRUE or FALSE, indicating whether or not to perform
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2427 # hierarchical clustering of the sample columns
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2428 sample_cluster,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2429 # a binary input of TRUE or FALSE, indicating whether or not to export
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2430 # the heatmap as a .png image into the working directory
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2431 export = FALSE,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2432 # bottom and right margins; adjust as needehttps://tex.stackexchange.com/a/56795d if contrast names are too long
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2433 margins = c(6, 6),
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2434 # print which kinases?
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2435 # - Mandatory argument, must be one of const_ksea_.*_kinases
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2436 which_kinases,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2437 # additional arguments to gplots::heatmap.2, such as:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2438 # - main: main title of plot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2439 # - xlab: x-axis label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2440 # - ylab: y-axis label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2441 ...
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2442 ) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2443 filter_m <- function(dataset, m_cutoff) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2444 filtered <- dataset[(dataset$m >= m_cutoff), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2445 return(filtered)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2446 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2447 score_list_m <- lapply(score_list, function(...) filter_m(..., m_cutoff))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2448 for (i in seq_len(length(score_list_m))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2449 names <- colnames(score_list_m[[i]])[c(2:7)]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2450 colnames(score_list_m[[i]])[c(2:7)] <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2451 paste(names, i, sep = ".")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2452 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2453 master <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2454 Reduce(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2455 f = function(...) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2456 base::merge(..., by = "Kinase.Gene", all = TRUE)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2457 },
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2458 x = score_list_m
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2459 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2460
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2461 row.names(master) <- master$Kinase.Gene
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2462 columns <- as.character(colnames(master))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2463 merged_scores <- as.matrix(master[, grep("z.score", columns), drop = FALSE])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2464 colnames(merged_scores) <- sample_labels
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2465 merged_stats <- as.matrix(master[, grep(stats, columns)])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2466 asterisk <- function(mtrx, p_cutoff) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2467 new <- data.frame()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2468 for (i in seq_len(nrow(mtrx))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2469 for (j in seq_len(ncol(mtrx))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2470 my_value <- mtrx[i, j]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2471 if (!is.na(my_value) && my_value < p_cutoff) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2472 new[i, j] <- "*"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2473 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2474 new[i, j] <- ""
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2475 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2476 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2477 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2478 return(new)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2479 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2480 merged_asterisk <- as.matrix(asterisk(merged_stats, p_cutoff))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2481
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2482 asterisk_rows <- rowSums(merged_asterisk == "*") > 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2483 all_rows <- rownames(merged_stats)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2484 names(asterisk_rows) <- all_rows
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2485 non_asterisk_rows <- names(asterisk_rows[asterisk_rows == FALSE])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2486 asterisk_rows <- names(asterisk_rows[asterisk_rows == TRUE])
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2487 merged_scores_asterisk <- merged_scores[names(asterisk_rows), , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2488 merged_scores_non_asterisk <- merged_scores[names(non_asterisk_rows), , drop = FALSE]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2489
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2490 row_list <- list()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2491 row_list[[const_ksea_astrsk_kinases]] <- asterisk_rows
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2492 row_list[[const_ksea_all_kinases]] <- all_rows
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2493 row_list[[const_ksea_nonastrsk_kinases]] <- non_asterisk_rows
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2494
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2495 i <- which_kinases
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2496 my_row_names <- row_list[[i]]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2497 scrs <- merged_scores[my_row_names, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2498 stts <- merged_stats[my_row_names, , drop = FALSE]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2499 merged_asterisk <- as.matrix(asterisk(stts, p_cutoff))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2500
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2501 color_breaks <- create_breaks(scrs)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2502 if (is.null(color_breaks)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2503 cat("No plot because matrix has too few rows.\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2504 return(NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2505 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2506 plot_height <- nrow(scrs) ^ 0.55
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2507 plot_width <- ncol(scrs) ^ 0.7
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2508 if (export == "TRUE") {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2509 png(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2510 "KSEA.Merged.Heatmap.png",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2511 width = plot_width * 300,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2512 height = 2 * plot_height * 300,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2513 res = 300,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2514 pointsize = 14
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2515 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2516 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2517 did_draw <- draw_kseaapp_summary_heatmap(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2518 x = scrs,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2519 sample_cluster = sample_cluster,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2520 merged_asterisk = merged_asterisk,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2521 color_breaks = color_breaks,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2522 margins = margins
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2523 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2524 if (export == "TRUE") {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2525 dev.off()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2526 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2527 if (!did_draw)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2528 return(NULL)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2529 return(my_row_names)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2530 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2531
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2532 # helpers for heatmaps of phosphopeptide intensities
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2533
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2534 # factory producing function to truncate string after n characters
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2535 trunc_n <- function(n) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2536 function(x) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2537 sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2538 X = x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2539 FUN = function(s) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2540 if (is.na(s))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2541 return("NA")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2542 cond <- try_catch_w_e(nchar(s) > n)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2543 if (!is.logical(cond$value)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2544 return(cond$value$message)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2545 } else if (cond$value) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2546 paste0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2547 strtrim(s, n),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2548 "..."
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2549 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2550 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2551 s
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2552 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2553 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2554 USE.NAMES = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2555 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2556 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2557 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2558 trunc_long_ppep <- function(x) trunc_n(40)(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2559 trunc_ppep <- function(x) trunc_n(g_ppep_trunc_n)(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2560 trunc_subgene <- function(x) trunc_n(g_subgene_trunc_n)(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2561 trunc_enriched_substrate <- function(x) trunc_n(g_sbstr_trunc_n)(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2562
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2563 # factory producing a function that returns a covariance
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2564 # matrix's rows (and columns) having variance > v_min
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2565 keep_cov_w_var_gtr_min <- function(v_min) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2566 function(x) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2567 if (!is.matrix(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2568 return(NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2569 keepers <- sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2570 X = seq_len(nrow(x)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2571 FUN = function(i) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2572 if (x[i, i] < v_min)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2573 NA
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2574 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2575 x[i, i]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2576 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2577 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2578 names(keepers) <- rownames(x)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2579 keepers <- keepers[!is.na(keepers)]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2580 keepers <- names(keepers)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2581 if (length(keepers) == 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2582 return(NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2583 x[keepers, keepers]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2584 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2585 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2586 # function that returns a matrix's rows having variance > 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2587 keep_cov_w_var_gtr_1 <- keep_cov_w_var_gtr_min(1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2588
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2589 # factory producing a function that returns
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2590 # - either a matrix's rows (rows = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2591 # - or a matrix's columns (rows = FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2592 # having variance > v_min
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2593 keep_var_gtr_min <- function(v_min) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2594 function(x, rows = TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2595 nrowcol <- if (rows) nrow else ncol
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2596 if (!is.matrix(x))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2597 return(NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2598 keepers <- sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2599 X = seq_len(nrowcol(x)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2600 FUN = function(i) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2601 row_var <- var(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2602 if (rows) x[i, ] else x[, i],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2603 na.rm = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2604 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2605 if (is.na(row_var) || row_var <= v_min) NA else i
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2606 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2607 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2608 keepers <- keepers[!is.na(keepers)]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2609 if (rows) x[keepers, ] else x[, keepers]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2610 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2611 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2612
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2613 keep_var_gtr_0 <- keep_var_gtr_min(0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2614
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2615 # function drawing heatmap of phosphopeptide intensities
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2616 ppep_heatmap <-
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2617 function(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2618 m, # matrix with rownames already formatted
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2619 cutoff, # cutoff used by hm_heading_function
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2620 hm_heading_function, # construct $ cat heading from m and cutoff
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2621 hm_main_title, # main title for plot (drawn below heading)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2622 suppress_row_dendrogram = TRUE, # set to false to show dendrogram
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2623 max_peptide_count = # experimental:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2624 g_intensity_hm_rows, # values of 50 and 75 worked well
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2625 master_cex = 1.0, # basis for text sizes
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2626 margins = NULL, # optional margins (bottom, right)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2627 cellnote = NULL, # optional matrix of character; dim = dim(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2628 adj = 0.5, # adjust text: 0 left, 0.5 middle, 1 right
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2629 row_scaling = # should row-scaling be applied if possible?
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2630 g_default_heatmap_row_scaling,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2631 ... # passthru to hm2plus or heatmap.2
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2632 ) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2633 use_heatmap_1 <- FALSE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2634 peptide_count <- 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2635 # emit the heading for the heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2636 if (hm_heading_function(m, cutoff)) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2637 nrow_m <- nrow(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2638 peptide_count <- min(max_peptide_count, nrow_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2639 if (nrow_m > 1) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2640 m_margin <- m[peptide_count:1, ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2641 # Margin was heuristically derived to accommodate the widest label
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2642 row_mchar_max <- max(nchar(rownames(m_margin)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2643 col_mchar_max <- max(nchar(colnames(m_margin)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2644 row_margin <- master_cex * row_mchar_max * 2.6
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2645 col_margin <- master_cex * col_mchar_max * 2.6
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2646 if (print_trace_messages) cat(sprintf("row_margin = %0.3f; ", row_margin))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2647 if (print_trace_messages) cat(sprintf("col_margin = %0.3f; ", col_margin))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2648 hm_call <- NULL
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2649 tryCatch(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2650 {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2651 # set non-argument parameters for hm_call inner function
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2652 my_row_cex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2653 master_cex * 200000 / (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2654 (max(nchar(rownames(m_margin)))^2) * g_intensity_hm_rows
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2655 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2656 m_hm <- m[peptide_count:1, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2657 if (is.null(cellnote)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2658 cellnote <- matrix("", nrow = nrow(m_hm), ncol = ncol(m_hm))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2659 cellnote[is.na(m_hm)] <- "NA"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2660 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2661 cellnote <- cellnote[peptide_count:1, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2662 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2663 m_hm[is.na(m_hm)] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2664 nrow_m_hm <- nrow(m_hm)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2665 ncol_m_hm <- ncol(m_hm)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2666 if (nrow_m_hm < 1 || ncol_m_hm < 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2667 return(peptide_count) # return zero as initialized above
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2668 my_limit <- g_intensity_hm_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2669
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2670
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2671 my_row_cex <- master_cex * (100 / (2 + row_mchar_max))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2672 my_col_cex <- master_cex * 6 * row_margin / col_margin
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2673 my_col_adj <- min(my_col_cex, my_row_cex) / my_col_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2674 my_col_cex <- min(my_col_cex, my_row_cex)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2675 col_margin <- sqrt(my_col_adj) * col_margin
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2676 if (print_trace_messages) cat(sprintf("my_row_cex = %0.3f; ", my_row_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2677 if (print_trace_messages) cat(sprintf("my_col_cex = %0.3f; ", my_col_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2678 if (is.null(margins)) my_margins <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2679 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2680 (my_col_cex + col_margin), # col
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2681 (my_row_cex + row_margin) / my_row_cex # row
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2682 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2683 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2684 my_margins <- margins
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2685
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2686 if (print_trace_messages) cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2687 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2688 "my_margins = c(%s)\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2689 paste(my_margins, collapse = ", ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2690 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2691 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2692 my_hm2_cex <- 2 * master_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2693 my_key_cex <- 0.9 - 0.1 * (g_intensity_hm_rows + nrow_m_hm) / g_intensity_hm_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2694 my_key_warp <- 1.5 * 22.75 / row_margin
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2695 my_key_cex <- min(1.10, my_key_warp * my_key_cex)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2696 my_hgt_scale <- 3.70 - 0.4 * (max(1, 0.9 * my_row_cex) - 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2697 my_hgt_scale <- 3.75 # 3.615
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2698 my_hgt_scale <- 3.60 # 3.615
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2699 if (print_trace_messages)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2700 cat_variable(my_hgt_scale, "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2701 my_warp <- max(0.1, 1.4 * (7.5 + nrow_m) / g_intensity_hm_rows)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2702 if (print_trace_messages)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2703 cat_variable(my_warp, "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2704 # added 0.9 heuristically...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2705 my_plot_height <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2706 (0.566 + 0.354 * (nrow_m / g_intensity_hm_rows)) *
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2707 min(my_hgt_scale, my_hgt_scale * my_warp)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2708 my_plot_height <- min(3.65, my_plot_height * g_intensity_hm_rows / 50)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2709 my_heights <- c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2710 0.3, # title and top dendrogram
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2711 my_plot_height, # plot and bottom margin
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2712 4.15 - my_hgt_scale, # legend
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2713 0.05 + my_hgt_scale - my_plot_height # whitespace below legend
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2714 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2715 my_note_cex <- min(0.8, my_row_cex, my_col_cex)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2716 if (print_trace_messages) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2717 cat_variable(my_plot_height, "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2718 cat_variable(4.19 - my_hgt_scale, "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2719 cat_variable(nrow_m_hm, "; ", 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2720 cat_variable(ncol_m_hm, "; ", 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2721 cat_variable(my_row_cex, "; ", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2722 cat_variable(my_col_cex, "; ", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2723 cat_variable(my_note_cex, "; ", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2724 cat_variable(my_key_cex, "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2725 cat_variable(my_hgt_scale, "; ", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2726 cat_variable(my_plot_height, "; ", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2727 cat_variable(my_warp, "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2728 cat_variable(my_heights, "; ", 2)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2729 cat_variable(sum(my_heights), "\n\n", 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2730 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2731
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2732 # define hm_call inner function
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2733 hm_call <- function(x, scaling, title) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2734 my_cex_main <- min(5.0, 220 / nchar(title))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2735 op <- par(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2736 cex.main = my_cex_main * master_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2737 adj = adj
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2738 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2739 if (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2740 !is.null(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2741 hm2plus(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2742 x,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2743 Colv = NA,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2744 Rowv = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2745 cexRow = my_row_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2746 cexCol = my_col_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2747 dendrogram = "row",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2748 las = 1,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2749 main = title,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2750 key_xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2751 cex = my_hm2_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2752 key_par = list(cex = my_key_cex),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2753 margins = my_margins,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2754 widths = c(0.4, 2.6, 1.5),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2755 heights = my_heights,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2756 mat = matrix(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2757 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2758 c(0, 3, 3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2759 c(2, 1, 1),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2760 c(0, 4, 0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2761 c(0, 0, 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2762 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2763 nrow = 4,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2764 ncol = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2765 byrow = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2766 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2767 na.rm = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2768 scale = scaling,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2769 srtcol = 90,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2770 srtrow = 0,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2771 xlab = "",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2772 cellnote = cellnote,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2773 notecex = my_note_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2774 ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2775 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2776 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2777 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2778 if (print_trace_messages) cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2779 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2780 "my_heights = c(%s); sum = %0.3f\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2781 paste(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2782 sprintf("%0.3f", my_heights),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2783 collapse = ", "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2784 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2785 sum(my_heights)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2786 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2787 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2788 if (print_trace_messages) cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2789 sprintf("my_key_cex = %0.3f\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2790 my_key_cex)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2791 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2792 if (print_trace_messages) cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2793 sprintf("my_key_cex/my_heights[3] = %0.3f\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2794 my_key_cex / my_heights[3])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2795 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2796 if (print_trace_messages) cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2797 sprintf("my_heights[2]/my_heights[3] = %0.3f\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2798 my_heights[2] / my_heights[3])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2799 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2800 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2801 par(op)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2802 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2803
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2804 # invoke hm_call inner function
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2805 if (row_scaling != "row" || sum(rowSums(!is.na(m_hm)) < 2))
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2806 hm_call(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2807 m_hm,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2808 "none",
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2809 "log(intensities), unimputed, and unnormalized"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2810 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2811 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2812 hm_call(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2813 m_hm,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2814 "row",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2815 "log(intensities), row-scaled, unimputed, and unnormalized"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2816 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2817 },
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2818 error = function(e) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2819 if (!is.null(hm_call)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2820 m_hm[is.na(m_hm)] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2821 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2822 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2823 if (nrow(m_hm) > 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2824 hm_call(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2825 m_hm,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2826 "none",
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2827 "log(intensities), zero-imputed, unnormalized"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2828 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2829 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2830 cat("\nThere are too few peptides to produce a heatmap.\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2831 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2832 error = function(r) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2833 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2834 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2835 "\n%s %s Internal message: %s\n\\newline\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2836 "Failure drawing heatmap,",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2837 "possibly because of too many missing values.\n\\newline\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2838 r$message
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2839 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2840 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2841 cat_margins()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2842 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2843 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2844 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2845 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2846 "\nFailure drawing heatmap, possibly because of too many missing values.\n"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2847 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2848 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2849 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2850 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2851 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2852 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2853 # return value:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2854 peptide_count
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2855 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2856
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2857 # function drawing heatmap of correlations if they exist, else covariances
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2858 cov_heatmap <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2859 function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2860 m, # matrix with rownames already formatted
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2861 top_substrates = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2862 ... # passthru to hm2plus or heatmap.2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2863 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2864 if (print_nb_messages) nbe(see_variable(m), " [", nrow(m), "x", ncol(m), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2865 #ACE nb(rowSums(m, na.rm = TRUE))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2866 #ACE bad_rows <- (rowSums(m, na.rm = TRUE) == 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2867 #ACE nb(see_variable(bad_rows))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2868 #ACE m <- m[-bad_rows, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2869 colnames_m <- colnames(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2870 is_na_m <- is.na(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2871 tmp <- m
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2872 tmp[is_na_m] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2873
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2874 tmp <- m[, 0 < colSums(x = tmp)] # by default, na.rm is FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2875
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2876 colnames_tmp <- colnames(tmp)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2877
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2878 my_low_p_seq <- seq(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2879 from = min(g_intensity_hm_rows, nrow(m)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2880 to = 1,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2881 by = -1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2882 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2883
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2884 if (g_correlate_substrates) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2885 # zap samples having zero or near-zero variance
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2886 tmp[is.na(tmp)] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2887 nzv <- caret::nearZeroVar(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2888 tmp, # matrix of values, samples x variables
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2889 freqCut = 1.01, # min(freq most prevalent value /
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2890 # freq second most prevalent)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2891 uniqueCut = 99 # max(number of unique values /
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2892 # total number of samples)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2893 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2894 tmp <- if (length(nzv) > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2895 m[, -nzv, drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2896 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2897 m
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2898 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2899 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2900 tmp <- m[my_low_p_seq, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2901 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2902
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2903
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2904 t_m <- t(tmp)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2905 t_m[is.na(t_m)] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2906 prefiltered_nrow <- ncol(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2907
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2908 my_corcov <- cov(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2909 did_filter_rows <- did_filter_cols <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2910 if (g_correlate_substrates && !is_positive_definite(my_corcov)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2911 my_correlate_substrates <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2912 t_m <- t(m[my_low_p_seq, , drop = FALSE])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2913 t_m[is.na(t_m)] <- 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2914 unfiltered_row_count <- ncol(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2915 unfiltered_col_count <- nrow(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2916
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2917 # zap empty samples
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2918 t_m <- t_m[0 < rowSums(x = t_m), ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2919 # zap substrates present in fewer than two samples
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2920 foo <- t_m > 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2921 foo <- colSums(x = foo) > 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2922 t_m <- t_m[, foo]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2923
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2924 did_filter_rows <- unfiltered_row_count > ncol(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2925 did_filter_cols <- unfiltered_col_count > nrow(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2926
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2927 colnames_tmp <- rownames(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2928 my_corcov <- cov(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2929 if (g_filter_cov_var_gt_1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2930 my_corcov <- keep_cov_w_var_gtr_1(my_corcov)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2931 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2932 } else if (g_correlate_substrates) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2933 my_corcov <- cov2cor(my_corcov)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2934 my_correlate_substrates <- TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2935 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2936 my_correlate_substrates <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2937 if (g_filter_cov_var_gt_1) my_corcov <- keep_cov_w_var_gtr_1(my_corcov)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2938 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2939
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2940 omitted_samples <- colnames_m[colnames_m %notin% colnames_tmp]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2941 suffix <- if (length(omitted_samples) > 1) "s" else ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2942
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2943 f_omissions <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2944 function(is_corr) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2945 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2946 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2947 "Below is the %s plot for %s substrates",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2948 if (is_corr) "correlation" else "covariance",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2949 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2950 if (top_substrates)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2951 "%0.0f \"highest-quality\""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2952 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2953 "%0.0f",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2954 ncol(t_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2955 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2956 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2957 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2958 if (did_filter_cols) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2959 cat(sprintf(", omitting sample%s ", suffix))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2960 latex_collapsed_vector(", ", omitted_samples)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2961 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2962 cat(".\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2963 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2964
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2965 if (is.null(my_corcov) || sum(!is.na(t_m)) < 2) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2966 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2967 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2968 "\\newline\n%s %s plot.\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2969 "Insufficient covariance to produce",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2970 if (my_correlate_substrates)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2971 "correlation"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2972 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2973 "covariance"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2974 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2975 "\\newpage\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2976 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2977 return(NULL)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2978 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2979
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2980 cat("\\leavevmode\n", "\\newpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2981 f_omissions(my_correlate_substrates)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2982
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2983 master_cex <- 0.4
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2984 max_nchar <- max(nchar(rownames(t_m)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2985 my_limit <- g_intensity_hm_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2986 diminution <- sqrt(my_limit / (my_limit + ncol(t_m)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2987 my_row_cex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2988 my_col_cex <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2989 min(1.75, master_cex * 9 * diminution ^ 1.5)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2990 my_margin <- 3 + my_row_cex * 64 / (8 + max_nchar)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2991 my_key_cex <- 1.4
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2992 my_hm2_cex <- 1.0 * master_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2993 my_hgt_scale <- 3.50 - 0.26 * (max(0.4, my_key_cex) - 0.4)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2994 my_hgt_scale <- 2.7
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2995
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2996 my_legend_height <- 4.0 - my_hgt_scale
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2997 my_legend_height <- 0.5 * my_key_cex
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2998 my_warp <- 0.65 * (my_limit + ncol(t_m)) / my_limit
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2999 my_warp <- 0.8
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3000 my_legend_height <- 0.77
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3001 my_legend_height <- 0.67
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3002 my_plot_height <- my_hgt_scale + (1 - my_warp) * my_legend_height
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3003 my_legend_height <- my_warp * my_legend_height
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3004
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3005 parjust <- par(adj = 0.5)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3006 on.exit(par(parjust))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3007 my_corcov <- my_corcov[order(rownames(my_corcov)), ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3008 my_main <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3009 sprintf("%s among %s substrates %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3010 if (my_correlate_substrates) "Correlation"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3011 else "Covariance",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3012 kinase_name,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3013 if (!my_correlate_substrates &&
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3014 g_filter_cov_var_gt_1 &&
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3015 did_filter_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3016 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3017 "having variance > 1"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3018 else ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3019 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3020 my_main_nchar <- nchar(my_main)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3021 my_heights <- c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3022 0.3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3023 my_plot_height,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3024 my_legend_height # was 4.0 - my_hgt_scale # was 4.19
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3025 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3026 if (print_trace_messages) cat(sprintf("max_nchar = %0.3f; ", max_nchar))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3027 if (print_trace_messages) cat(sprintf("my_margin = %0.3f; ", my_margin))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3028 if (print_trace_messages) cat(sprintf("my_plot_height = %0.3f\n\n", my_plot_height))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3029 if (print_trace_messages) cat(sprintf("master_cex = %0.3f; ", master_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3030 if (print_trace_messages) cat(sprintf("my_row_cex = %0.3f; ", my_row_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3031 if (print_trace_messages) cat(sprintf("my_col_cex = %0.3f; ", my_col_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3032 if (print_trace_messages) cat(sprintf("my_key_cex = %0.3f\n\n", my_key_cex))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3033 if (print_trace_messages) cat(sprintf("my_hgt_scale = %0.3f\n\n", my_hgt_scale))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3034 if (print_trace_messages) cat(sprintf("legend height = %0.3f\n\n", my_legend_height))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3035 if (print_trace_messages) cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3036 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3037 "my_heights = c(%s); sum = %0.3f\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3038 paste(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3039 sprintf("%0.3f", my_heights),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3040 collapse = ", "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3041 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3042 sum(my_heights)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3043 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3044 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3045 op <- par(cex.main = (30 + my_main_nchar) / my_main_nchar)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3046 on.exit(par(op))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3047 hm2plus(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3048 x = my_corcov,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3049 cex = my_hm2_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3050 cexCol = my_col_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3051 cexRow = my_row_cex,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3052 density_info = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3053 denhgt = 0.15,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3054 denwid = 0.5,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3055 divergent = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3056 key_par = list(cex = my_key_cex),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3057 key_xlab = if (my_correlate_substrates) "Correlation"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3058 else "Covariance",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3059 main = my_main,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3060 mat = matrix(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3061 c(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3062 c(0, 3, 3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3063 c(2, 1, 1),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3064 c(0, 4, 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3065 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3066 nrow = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3067 ncol = 3,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3068 byrow = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3069 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3070 heights = my_heights,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3071 margins = c(my_margin, my_margin),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3072 widths = c(0.5, 3.1, 0.9),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3073 scale = "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3074 symkey = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3075 symbreaks = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3076 symm = FALSE #TODO evaluate TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3077 # ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3078 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3079 } # end cov_heatmap
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3080
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3081 ### FILE IMPORT
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3082
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3083 # function reading bzipped file to data.frame
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3084 bzip2df <- function(d, f, ctor = bzfile) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3085 # read.delim file (by default, compressed by bzip2)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3086 if (file.exists(f)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3087 conn <- NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3088 pf <- parent.frame()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3089 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3090 assign(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3091 as.character(substitute(d)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3092 read.delim(conn <- bzfile(f, open = "r")),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3093 pf
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3094 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3095 finally = if (!is.null(conn)) close(conn)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3096 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3097 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3098 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3099
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3100 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3101
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3102 # Purpose
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3103
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3104 The purpose of this analysis is to perform for phosphopeptides:
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3105
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3106 - imputation of missing values,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3107 - quantile normalization,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3108 - ANOVA (using the R stats::`r params$oneWayManyCategories` function),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3109 - assignment of an FDR-adjusted $p$-value and a "quality score" to each phosphopeptide, and
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3110 - KSEA (Kinase-Substrate Enrichment Analysis) using code adapted from the CRAN `KSEAapp` package to search for kinase substrates from the following databases:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3111 - PhosphoSitesPlus [https://www.phosphosite.org](https://www.phosphosite.org)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3112 - The Human Proteome Database [http://hprd.org](http://hprd.org)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3113 - NetworKIN [http://networkin.science/](http://networkin.science/)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3114 - Phosida [http://pegasus.biochem.mpg.de/phosida/help/motifs.aspx](http://pegasus.biochem.mpg.de/phosida/help/motifs.aspx)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3115
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3116 ```{r include = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3117
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3118 if (params$kseaUseAbsoluteLog2FC) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3119 sfc <- "|s|"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3120 pfc <- "|p|"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3121 pfc_txt <- "$\\text{absolute value}({\\log_2 (\\text{fold-change})})$"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3122 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3123 sfc <- "s"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3124 pfc <- "p"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3125 pfc_txt <- "${\\log_2 (\\text{fold-change}})$"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3126 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3127
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3128 ksea_heatmap_titles <- list()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3129 ksea_heatmap_titles[[const_ksea_astrsk_kinases]] <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3130 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3131 "Summary for all kinases enriched in one or more contrasts at %s < %s",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3132 ksea_cutoff_statistic,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3133 ksea_cutoff_threshold
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3134 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3135 ksea_heatmap_titles[[const_ksea_all_kinases]] <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3136 "Summary figure for all contrasts and all kinases"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3137 ksea_heatmap_titles[[const_ksea_nonastrsk_kinases]] <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3138 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3139 "Summary for all kinases not enriched at %s < %s in any contrast",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3140 ksea_cutoff_statistic,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3141 ksea_cutoff_threshold
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3142 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3143 # hash to hold names of significantly enriched kinases
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3144 ksea_asterisk_hash <- new_env()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3145
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3146 # PROCESS (mostly read) PARAMETERS
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3147
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3148 # False discovery rate adjustment for ANOVA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3149 # Since pY abundance is low, set to 0.10 and 0.20 in addition to 0.05
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3150 val_fdr <- read.table(file = alpha_file, sep = "\t", header = FALSE, quote = "")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3151
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3152 if (
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3153 ncol(val_fdr) != 1 ||
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3154 sum(!is.numeric(val_fdr[, 1])) ||
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3155 sum(val_fdr[, 1] < 0) ||
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3156 sum(val_fdr[, 1] > 1)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3157 ) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3158 cat("alphaFile should be one column of numbers within the range [0.0,1.0]")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3159 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3160 knitr::knit_exit()
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3161 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3162 val_fdr <- val_fdr[, 1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3163
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3164 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3165
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3166 ```{r echo = FALSE, results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3167
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3168
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3169 result <- file.copy(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3170 from = preproc_db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3171 to = ksea_app_prep_db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3172 overwrite = TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3173 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3174 if (!result) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3175 write(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3176 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3177 "fatal error copying initial database '%s' to output '%s'",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3178 preproc_db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3179 ksea_app_prep_db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3180 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3181 stderr()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3182 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3183 if (sys.nframe() > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3184 cat("Cannot continue and quit() failed. Goodbye.")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3185 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3186 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3187 # in case knit_exit doesn't exit
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3188 quit(save = "no", status = 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3189 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3190 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3191
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3192 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3193 write.table(x = param_df, file = "test-data/params.txt")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3194 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3195
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3196 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3197
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3198 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3199 ### READ DATA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3200
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3201 # read.table reads a file in table format and creates a data frame from it.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3202 # - note that `quote = ""` means that quotation marks are treated literally.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3203 full_data <- read.table(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3204 file = input_file,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3205 sep = "\t",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3206 header = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3207 quote = "",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3208 check.names = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3209 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3210
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3211 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3212
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3213
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3214 # Extraction of Sample Classes and Names from Input Data
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3215
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3216 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3217
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3218 data_column_indices <- grep(first_data_column, names(full_data), perl = TRUE)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3219 my_column_names <- names(full_data)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3220
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3221 if (!fdc_is_integer) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3222 if (length(data_column_indices) > 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3223 first_data_column <- data_column_indices[1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3224 } else {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3225 cat(paste("failed to convert firstDataColumn:", first_data_column))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3226 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3227 knitr::knit_exit()
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3228 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3229 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3230
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3231 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3232 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3233 paste(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3234 "\n\nThe input data file has peptide-intensity data",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3235 "in columns %d (\"%s\") through %d (\"%s\")."
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3236 ),
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3237 tmp <- min(data_column_indices),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3238 my_column_names[tmp],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3239 tmp <- max(data_column_indices),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3240 my_column_names[tmp]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3241 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3242 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3243
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3244 if (TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3245 cat0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3246 table_offset(i = 1, new = TRUE),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3247 "Sample classes and names are shown in ",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3248 table_href(),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3249 ".\n\n"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3250 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3251 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3252 cat0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3253 "\\newcounter{offset}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3254 "\\setcounter{offset}{\\value{table}}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3255 "\\stepcounter{offset}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3256 "Sample classes and names are shown in ",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3257 table_href(),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3258 ".\n\n"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3259 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3260 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3261
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3262 #TODO remove this unused variable and assignment
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3263 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3264 # Write column names as a LaTeX enumerated list.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3265 column_name_df <- data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3266 column = seq_len(length(colnames(full_data))),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3267 name = paste0("\\verb@", colnames(full_data), "@")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3268 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3269 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3270
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3271 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3272
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3273 ```{r echo = FALSE, results = 'asis'}
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3274 # extract intensity columns from full_data to quant_data
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3275 quant_data <- full_data[first_data_column:length(full_data)]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3276 quant_data[quant_data == 0] <- NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3277 rownames(quant_data) <- rownames(full_data) <- full_data$Phosphopeptide
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3278 full_data_names <- colnames(quant_data)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3279 # Extract factors and trt-replicates using regular expressions.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3280 # Typically:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3281 # regex_sample_names is "\\.\\d+[A-Z]$"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3282 # regex_sample_grouping is "\\d+"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3283 # This would distinguish trt-replicates by terminal letter [A-Z]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3284 # in sample names and group them into trts by the preceding digits.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3285 # e.g.:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3286 # group .1A .1B .1C into group 1;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3287 # group .2A .2B .2C, into group 2;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3288 # etc.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3289 m <- regexpr(regex_sample_names, colnames(quant_data), perl = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3290 sample_name_matches <- regmatches(names(quant_data), m)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3291 colnames(quant_data) <- sample_name_matches
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3292
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3293 write_debug_file(quant_data)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3294
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3295 rx_match <- regexpr(regex_sample_grouping, sample_name_matches, perl = TRUE)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3296 smpl_trt <- as.factor(regmatches(sample_name_matches, rx_match))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3297
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3298 if (print_nb_messages) nbe(see_variable(smpl_trt, "\n\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3299 if (print_nb_messages) nbe(see_variable(sample_name_matches, "\n\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3300 if (print_nb_messages) nbe(see_variable(full_data_names, "\n\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3301
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3302 sample_treatment_df <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3303 save_sample_treatment_df <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3304 data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3305 class = smpl_trt,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3306 sample = sample_name_matches,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3307 full_sample_names = full_data_names
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3308 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3309
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3310 if (print_nb_messages) nbe(see_variable(sample_treatment_df, "\n\n"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3311
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3312 # reorder data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3313 my_order <- with(sample_treatment_df, order(class, sample))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3314 quant_data <- quant_data[, my_order]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3315 sample_name_matches <- sample_name_matches[my_order]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3316 smpl_trt <- smpl_trt[my_order]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3317 sample_treatment_df <- data.frame(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3318 class = smpl_trt,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3319 sample = sample_name_matches
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3320 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3321
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3322 # filter smpl_trt as appropriate
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3323 if (sample_group_filter %in% c("include", "exclude")) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3324 include_sample <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3325 mgrepl(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3326 v = sample_group_filter_patterns,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3327 s = as.character(smpl_trt),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3328 fixed = sample_group_filter_fixed,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3329 perl = sample_group_filter_perl,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3330 ignore.case = sample_group_filter_nocase
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3331 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3332 if (sum(include_sample) < 2) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3333 errmsg <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3334 paste(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3335 "ERROR:",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3336 sum(include_sample),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3337 "samples are too few for analysis;",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3338 "check input parameters for sample-name parsing"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3339 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3340 cat0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3341 errmsg,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3342 "\\stepcounter{offset}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3343 " in ",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3344 table_href(),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3345 ".\n\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3346 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3347 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3348 x = save_sample_treatment_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3349 tabstops = c(1.25, 1.25),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3350 caption = "Sample classes",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3351 use_subsubsection_header = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3352 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3353 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3354 x =
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3355 param_df[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3356 c("regexSampleNames",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3357 "regexSampleGrouping",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3358 "groupFilterPatterns",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3359 "groupFilter",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3360 "groupFilterMode"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3361 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3362 ],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3363 tabstops = c(1.75),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3364 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3365 caption = "Input parameters for sample-name parsing",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3366 verbatim = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3367 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3368 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3369 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3370 return(invisible(-1))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3371 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3372 sample_treatment_df <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3373 if (sample_group_filter == "include")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3374 sample_treatment_df[include_sample, ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3375 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3376 sample_treatment_df[!include_sample, ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3377 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3378 include_sample <- rep.int(TRUE, length(smpl_trt))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3379 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3380 sample_name_matches <- sample_treatment_df$sample
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3381 rx_match <- regexpr(regex_sample_grouping, sample_name_matches, perl = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3382 smpl_trt <- as.factor(regmatches(sample_name_matches, rx_match))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3383 sample_treatment_df$class <- smpl_trt
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3384
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3385 # filter quant_data as appropriate
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3386 number_of_samples <- length(sample_name_matches)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3387 quant_data <- quant_data[, sample_name_matches]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3388
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3389 sample_level_integers <- as.integer(smpl_trt)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3390 sample_treatment_levels <- levels(smpl_trt)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3391 count_of_treatment_levels <- length(sample_treatment_levels)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3392
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3393 # for each phosphopeptide, across treatment levels, compute minimum
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3394 # count of observed (i.e., non-missing) values
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3395 my_env <- new_env()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3396 for (l in sample_treatment_levels)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3397 my_env[[as.character(l)]] <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3398 as.vector(rowSums(!is.na(quant_data[l == smpl_trt])))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3399 min_group_obs_count <- row_apply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3400 x = Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3401 f = function(l, r) cbind(l, my_env[[r]]),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3402 x = sample_treatment_levels,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3403 init = c()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3404 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3405 fun = min
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3406 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3407 names(min_group_obs_count) <- rownames(quant_data)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3408 rm(my_env)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3409
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3410 # display (possibly-filtered) results
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3411 cat("\\newpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3412
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3413 if (sum(include_sample) > 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3414 data_frame_tabbing_latex(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3415 x = sample_treatment_df,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3416 tabstops = c(1.25),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3417 caption = "Sample classes",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3418 use_subsubsection_header = FALSE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3419 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3420 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3421 sample_name_grow <- 10 / (10 + max(nchar(sample_name_matches) + 6))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3422 sample_colsep <- transition_positions(as.integer(sample_treatment_df$class))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3423 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3424
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3425 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3426 cat("\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3427 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3428
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3429 ## Are the log-transformed sample distributions similar?
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3430
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3431 ```{r echo = FALSE, fig.dim = c(9, 6.5), results = 'asis'}
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3432
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3433 quant_data[quant_data == 0] <- NA #replace 0 with NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3434 quant_data_log <- log10(quant_data)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3435
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3436 rownames(quant_data_log) <- rownames(quant_data)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3437 colnames(quant_data_log) <- sample_name_matches
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3438
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3439 write_debug_file(quant_data_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3440
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3441 g_ppep_distrib_ctl <- new_env()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3442 g_ppep_distrib_ctl$xlab_line <- 3.5 + 11.86 * (0.67 - sample_name_grow)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3443 g_ppep_distrib_ctl$mai_bottom <- (0.5 + 3.95 * (0.67 - sample_name_grow))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3444 g_ppep_distrib_ctl$axis <- (0.6 + 0.925 * (0.67 - sample_name_grow))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3445
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3446 my_ppep_distrib_bxp <- function(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3447 x
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3448 , sample_name_grow = sample_name_grow
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3449 , main
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3450 , varwidth = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3451 , sub = NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3452 , xlab
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3453 , ylab
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3454 , col = const_boxplot_fill
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3455 , notch = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3456 , ppep_distrib_ctl = g_ppep_distrib_ctl
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3457 , ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3458 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3459 my_xlab_line <- g_ppep_distrib_ctl$xlab_line
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3460 my_mai_bottom <- g_ppep_distrib_ctl$mai_bottom
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3461 my_axis <- g_ppep_distrib_ctl$axis
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3462
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3463 if (print_trace_messages) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3464 cat_variable(my_xlab_line, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3465 cat_variable(my_mai_bottom, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3466 cat_variable(my_axis, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3467 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3468
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3469 old_par <- par(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3470 mai = par("mai") + c(my_mai_bottom, 0, 0, 0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3471 cex.axis = my_axis,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3472 cex.lab = 1.2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3473 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3474 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3475 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3476 # Vertical plot
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3477 boxplot(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3478 x
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3479 , las = 2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3480 , col = col
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3481 , main = main
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3482 , sub = NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3483 , ylab = ylab
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3484 , xlab = NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3485 , notch = notch
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3486 , varwidth = varwidth
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3487 , ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3488 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3489 title(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3490 sub = sub
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3491 , cex.sub = 1.0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3492 , line = my_xlab_line + 1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3493 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3494 title(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3495 xlab = xlab
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3496 , line = my_xlab_line
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3497 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3498 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3499 finally = par(old_par)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3500 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3501 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3502
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3503 my_ppep_distrib_bxp(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3504 x = quant_data_log
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3505 , sample_name_grow = sample_name_grow
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3506 , main = "Peptide intensities for each sample"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3507 , varwidth = boxplot_varwidth
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3508 , sub = "Box widths reflect number of peptides for sample"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3509 , xlab = "Sample"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3510 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3511 , col = const_boxplot_fill
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3512 , notch = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3513 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3514
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3515 cat("\n\n\n\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3516
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3517 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3518
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3519 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 4), results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3520 if (nrow(quant_data_log) > 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3521 quant_data_log_stack <- stack(quant_data_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3522 ggplot2::ggplot(quant_data_log_stack, ggplot2::aes(x = values)) +
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3523 ggplot2::xlab(latex2exp::TeX("$log_{10}$(peptide intensity)")) +
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3524 ggplot2::ylab("Probability density") +
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3525 ggplot2::geom_density(ggplot2::aes(group = ind, colour = ind), na.rm = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3526 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3527 cat("No density plot because there are too few peptides.\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3528 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3529 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3530
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3531 ## Globally, are peptide intensities are approximately unimodal?
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3532
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3533 <!--
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3534 # bquote could be used as an alternative to latex2exp::TeX below particularly
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3535 # and when plotting math expressions generally, at the expense of mastering
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3536 # another syntax, which hardly seems worthwhile when I need to use TeX
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3537 # elsewhere; here's an introduction to bquote:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3538 # https://www.r-bloggers.com/2018/03/math-notation-for-r-plot-titles-expression-and-bquote/
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3539 -->
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3540 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 5), results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3541
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3542 # identify the location of missing values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3543 fin <- is.finite(as.numeric(as.matrix(quant_data_log)))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3544
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3545 logvalues <- as.numeric(as.matrix(quant_data_log))[fin]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3546 logvalues_density <- density(logvalues)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3547 plot(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3548 x = logvalues_density,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3549 main = latex2exp::TeX(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3550 "Smoothed estimated probability density vs. $log_{10}$(peptide intensity)"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3551 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3552 xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3553 ylab = "Probability density"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3554 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3555 hist(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3556 x = as.numeric(as.matrix(quant_data_log)),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3557 xlim = c(min(logvalues_density$x), max(logvalues_density$x)),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3558 breaks = 100,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3559 main = latex2exp::TeX("Frequency vs. $log_{10}$(peptide intensity)"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3560 xlab = latex2exp::TeX("$log_{10}$(peptide intensity)")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3561 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3562 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3563
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3564 # Characterization of Input Data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3565
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3566 ## Distribution of standard deviations of $log_{10}(\text{intensity})$, ignoring missing values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3567
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3568 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 5), results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3569 # determine quantile
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3570 q1 <- quantile(logvalues, probs = mean_percentile)[1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3571
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3572 # 1 = row of matrix (ie, phosphopeptide)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3573 sds <- row_apply(quant_data_log, sd_finite)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3574 if (sum(!is.na(sds)) > 2) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3575 plot(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3576 density(sds, na.rm = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3577 , main = "Smoothed estimated probability density vs. std. deviation"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3578 , sub = "(probability estimation made with Gaussian smoothing)"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3579 , ylab = "Probability density"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3580 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3581 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3582 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3583 "At least two non-missing values are required to plot",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3584 "probability density.\n\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3585 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3586 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3587
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3588 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3589
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3590 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3591 # Determine number of cells to impute
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3592 temp <- quant_data[is.na(quant_data)]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3593
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3594 # Determine number of values to impute
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3595 number_to_impute <- length(temp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3596
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3597 # Determine percent of missing values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3598 pct_missing_values <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3599 round(length(temp) / (length(logvalues) + length(temp)) * 100)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3600 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3601
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3602 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3603
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3604 # prep for trt-median based imputation
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3605
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3606 ```
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3607 # Imputation of Missing Values
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3608
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3609 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3610
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3611 imp_smry_pot_peptides_before <- nrow(quant_data_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3612 imp_smry_missing_values_before <- number_to_impute
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3613 imp_smry_pct_missing <- pct_missing_values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3614
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3615 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3616
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3617 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3618 #Determine number of cells to impute
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3619
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3620 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3621 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3622
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3623 # Identify which values are missing and need to be imputed
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3624 ind <- which(is.na(quant_data), arr.ind = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3625
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3626 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3627 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3628
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3629 # Apply imputation
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3630 switch(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3631 imputation_method
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3632 , "group-median" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3633 quant_data_imp <- quant_data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3634 imputation_method_description <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3635 paste("Substitute missing value with",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3636 "median peptide-intensity for sample group.\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3637 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3638 # Take the accurate ln(x+1) because the data are log-normally distributed
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3639 # and because median can involve an average of two measurements.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3640 quant_data_imp <- log1p(quant_data_imp)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3641 for (i in seq_len(count_of_treatment_levels)) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3642 # Determine the columns for this factor-level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3643 level_cols <- i == sample_level_integers
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3644 # Extract those columns
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3645 lvlsbst <- quant_data_imp[, level_cols, drop = FALSE]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3646 # assign to ind the row-column pairs corresponding to each NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3647 ind <- which(is.na(lvlsbst), arr.ind = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3648 # No group-median exists if there is only one sample
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3649 # a given ppep has no measurement; otherwise, proceed.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3650 if (ncol(lvlsbst) > 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3651 the_centers <-
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3652 row_apply(lvlsbst, median, na.rm = TRUE)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3653 for (j in seq_len(nrow(lvlsbst))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3654 for (k in seq_len(ncol(lvlsbst))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3655 if (is.na(lvlsbst[j, k])) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3656 lvlsbst[j, k] <- the_centers[j]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3657 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3658 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3659 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3660 quant_data_imp[, level_cols] <- lvlsbst
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3661 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3662 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3663 # Take the accurate e^x - 1 to match scaling of original input.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3664 quant_data_imp <- round(expm1(quant_data_imp_ln <- quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3665 good_rows <- !is.na(rowMeans(quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3666 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3667 , "median" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3668 quant_data_imp <- quant_data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3669 imputation_method_description <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3670 paste("Substitute missing value with",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3671 "median peptide-intensity across all sample classes.\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3672 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3673 # Take the accurate ln(x+1) because the data are log-normally distributed
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3674 # and because median can involve an average of two measurements.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3675 quant_data_imp <- log1p(quant_data_imp)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3676 quant_data_imp[ind] <- row_apply(quant_data_imp, median, na.rm = TRUE)[ind[, 1]]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3677 # Take the accurate e^x - 1 to match scaling of original input.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3678 quant_data_imp <- round(expm1(quant_data_imp_ln <- quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3679 good_rows <- !is.nan(rowMeans(quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3680 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3681 , "mean" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3682 quant_data_imp <- quant_data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3683 imputation_method_description <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3684 paste("Substitute missing value with",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3685 "geometric-mean peptide intensity across all sample classes.\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3686 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3687 # Take the accurate ln(x+1) because the data are log-normally distributed,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3688 # so arguments to mean should be previously transformed.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3689 # this will have to be
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3690 quant_data_imp <- log1p(quant_data_imp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3691 # Assign to NA cells the mean for the row
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3692 quant_data_imp[ind] <- row_apply(quant_data_imp, mean, na.rm = TRUE)[ind[, 1]]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3693 # Take the accurate e^x - 1 to match scaling of original input.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3694 quant_data_imp <- round(expm1(quant_data_imp_ln <- quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3695 good_rows <- !is.nan(rowMeans(quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3696 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3697 , "random" = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3698 quant_data_imp <- quant_data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3699 m1 <- median(sds, na.rm = TRUE) * sd_percentile #sd to be used is the median sd
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3700 # If you want results to be reproducible, you will want to call
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3701 # base::set.seed before calling stats::rnorm
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3702 imputation_method_description <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3703 paste("Substitute each missing value with random intensity",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3704 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3705 "random intensity $N \\sim (%0.2f, %0.2f)$.\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3706 q1, m1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3707 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3708 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3709 cat(sprintf("mean_percentile (from input parameter) is %2.0f\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3710 100 * mean_percentile))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3711 cat(sprintf("sd_percentile (from input parameter) is %0.2f\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3712 sd_percentile))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3713 quant_data_imp[ind] <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3714 10 ^ rnorm(number_to_impute, mean = q1, sd = m1)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3715 quant_data_imp_ln <- log1p(quant_data_imp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3716 good_rows <- !is.nan(rowMeans(quant_data_imp))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3717 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3718 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3719 quant_data_imp_log10 <- quant_data_imp_ln * const_log10_e
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3720
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3721 if (length(good_rows) < 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3722 print("ERROR: Cannot impute data; there are no good rows!")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3723 return(-1)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3724 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3725 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3726
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3727 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3728 cat("\\quad\n\nImputation method:\n\n\n", imputation_method_description)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3729 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3730
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3731 ```{r echo = FALSE}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3732
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3733 imp_smry_pot_peptides_after <- sum(good_rows)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3734 imp_smry_rejected_after <- sum(!good_rows)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3735 imp_smry_missing_values_after <- sum(is.na(quant_data_imp[good_rows, ]))
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3736
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
3737 # From ?`%in%`:
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
3738 # %in% is currently defined as function(x, table) match(x, table, nomatch = 0) > 0
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3739
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3740 stock_in <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3741 names(good_rows) %in%
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3742 names(min_group_obs_count[g_intensity_min_per_class <= min_group_obs_count])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3743 if (print_nb_messages) nbe(see_variable(stock_in), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3744
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3745 explicit_in <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3746 0 < match(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3747 names(good_rows),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3748 names(min_group_obs_count[g_intensity_min_per_class <= min_group_obs_count])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3749 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3750 if (print_nb_messages) nbe(see_variable(explicit_in), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3751
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3752 great_enough_row_names <- good_rows[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3753 names(good_rows) %in%
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3754 names(min_group_obs_count[g_intensity_min_per_class <= min_group_obs_count])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3755 ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3756 if (print_nb_messages) nbe(see_variable(great_enough_row_names), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3757 great_enough_row_names <- great_enough_row_names[great_enough_row_names]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3758 if (print_nb_messages) nbe(see_variable(great_enough_row_names), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3759 ```
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3760
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3761 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3762 # ref: http://www1.maths.leeds.ac.uk/latex/TableHelp1.pdf
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3763 tabular_lines_fmt <- paste(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3764 "\\begin{table}[hb]", # h(inline); b(bottom); t (top) or p (separate page)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3765 " \\leavevmode",
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3766 " \\caption{Imputation Results}",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3767 " \\centering", # \centering centers the table on the page
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3768 " \\begin{tabular}{l c c c}",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3769 " \\hline\\hline",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3770 " \\ & potential peptides & missing values & rejected",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3771 " peptides \\\\ [0.5ex]",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3772 " \\hline",
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3773 " before imputation & %d & %d (%d\\%s) & \\\\",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3774 " after imputation & %d & %d & %d \\\\",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3775 " after keep comparable & %d & & %d \\\\ [1ex]",
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3776 " \\hline",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3777 " \\end{tabular}",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3778 #" \\label{table:nonlin}", # may be used to refer this table in the text
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3779 "\\end{table}",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3780 sep = "\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3781 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3782 tabular_lines <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3783 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3784 tabular_lines_fmt,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3785 imp_smry_pot_peptides_before,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3786 imp_smry_missing_values_before,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3787 imp_smry_pct_missing,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3788 "%",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3789 imp_smry_pot_peptides_after,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3790 imp_smry_missing_values_after,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3791 imp_smry_rejected_after,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3792 length(great_enough_row_names),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3793 imp_smry_pot_peptides_before -
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3794 length(great_enough_row_names)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3795 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3796 cat(tabular_lines)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3797 ```
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3798
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3799 ```{r filter_good_rows, echo = FALSE}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3800
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3801 if (print_nb_messages) nbe("before name extraction, ", see_variable(length(good_rows)), " ", see_variable(good_rows), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3802 good_rows <- names(good_rows[names(great_enough_row_names)])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3803 if (print_nb_messages) nbe("after name extraction, ", see_variable(length(good_rows)), see_variable(good_rows), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3804
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3805 #ACE min_group_obs_count <- min_group_obs_count[names(great_enough_row_names)]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3806 #ACE nbe("good_rows")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3807 #ACE nbe(see_variable(good_rows))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3808 #ACE nbe("names(min_group_obs_count) before filter for good rows")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3809 #ACE nbe(see_variable(names(min_group_obs_count)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3810 min_group_obs_count <- min_group_obs_count[good_rows]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3811 #ACE nbe("min_group_obs_count after filter for good rows")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3812 #ACE nbe(see_variable(names(min_group_obs_count)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3813
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3814 # Zap rows where imputation was insufficiently effective
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3815 full_data <- full_data [good_rows, ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3816 quant_data <- quant_data [good_rows, ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3817 quant_data_log <- quant_data_log [good_rows, ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3818
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3819 if (print_nb_messages) nbe("before row filter, ", see_variable(nrow(quant_data_imp)), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3820 quant_data_imp <- quant_data_imp[good_rows, ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3821 if (print_nb_messages) nbe("after row filter, ", see_variable(nrow(quant_data_imp)), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3822 write_debug_file(quant_data_imp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3823 quant_data_imp_good_rows <- quant_data_imp
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3824
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3825 write_debug_file(quant_data_imp_good_rows)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3826 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3827
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3828 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3829
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3830 can_plot_before_after_imp <- TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3831 d_combined <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3832 as.numeric(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3833 as.matrix(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3834 log10(quant_data_imp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3835 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3836 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3837 d_original <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3838 as.numeric(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3839 as.matrix(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3840 log10(quant_data_imp[!is.na(quant_data)])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3841 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3842 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3843
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3844 if (sum(!is.na(d_original)) > 2) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3845 d_original <- density(d_original)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3846 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3847 can_plot_before_after_imp <- FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3848 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3849 if (can_plot_before_after_imp && sum(is.na(d_combined)) < 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3850 d_combined <- density(d_combined)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3851 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3852 can_plot_before_after_imp <- FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3853 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3854
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3855 if (sum(is.na(quant_data)) > 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3856 # There ARE missing values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3857 d_imputed <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3858 as.numeric(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3859 as.matrix(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3860 log10(quant_data_imp[is.na(quant_data)])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3861 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3862 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3863 if (can_plot_before_after_imp && sum(is.na(d_imputed)) < 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3864 d_imputed <- (density(d_imputed))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3865 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3866 can_plot_before_after_imp <- FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3867 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3868 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3869 # There are NO missing values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3870 d_imputed <- d_combined
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3871 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3872
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3873 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3874
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3875 ```{r echo = FALSE, fig.dim = c(9, 6.5), results = 'asis'}
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3876 zero_sd_rownames <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3877 rownames(quant_data_imp)[
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3878 is.na((row_apply(quant_data_imp, sd, na.rm = TRUE)) == 0)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3879 ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3880
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3881 if (length(zero_sd_rownames) >= nrow(quant_data_imp)) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3882 cat("All peptides have zero standard deviation. Cannot continue.")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3883 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3884 knitr::knit_exit()
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3885 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3886 if (length(zero_sd_rownames) > 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3887 cat(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3888 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3889 "%d %s %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3890 length(zero_sd_rownames),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3891 "peptides with zero variance",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3892 "were removed from statistical consideration"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3893 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3894 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3895 zap_named_rows <- function(df, nms) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3896 return(df[!(row.names(df) %in% nms), ])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3897 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3898 quant_data_imp <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3899 zap_named_rows(quant_data_imp, zero_sd_rownames)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3900 quant_data <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3901 zap_named_rows(quant_data, zero_sd_rownames)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3902 full_data <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3903 zap_named_rows(full_data, zero_sd_rownames)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3904 min_group_obs_count <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3905 min_group_obs_count[names(min_group_obs_count) %notin% zero_sd_rownames]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3906 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3907
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3908 if (sum(is.na(quant_data)) > 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3909 cat("\\leavevmode\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3910 # Copy quant data to x
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3911 x <- quant_data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3912 # x gets to have values of:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3913 # - NA for observed values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3914 # - 1 for missing values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3915 x[is.na(x)] <- 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3916 x[x > 1] <- NA
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3917 x[x == 0] <- 1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3918 # Log-transform imputed data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3919 # update variable because rows may have been eliminated from quant_data_imp
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3920 quant_data_imp_log10 <- log10(quant_data_imp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3921
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3922 write_debug_file(quant_data_imp_log10)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3923
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3924 # Set blue_dots to log of quant data or NA for NA quant data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3925 blue_dots <- log10(quant_data)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3926 # Set red_dots to log of imputed data or NA for observed quant data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3927 red_dots <- quant_data_imp_log10 * x
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3928
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3929 count_red <- sum(!is.na(red_dots))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3930 count_blue <- sum(!is.na(blue_dots))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3931 ylim_save <- ylim <- c(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3932 min(red_dots, blue_dots, na.rm = TRUE),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3933 max(red_dots, blue_dots, na.rm = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3934 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3935 show_stripchart <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3936 50 > (count_red + count_blue) / length(sample_name_matches)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3937 if (show_stripchart) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3938 boxplot_sub <- "Light blue = data before imputation; Red = imputed data;"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3939 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3940 boxplot_sub <- ""
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3941 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3942
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3943 # Vertical plot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3944 colnames(blue_dots) <- sample_name_matches
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3945 my_ppep_distrib_bxp(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3946 x = blue_dots
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3947 , sample_name_grow = sample_name_grow
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3948 , main = "Peptide intensities after eliminating unusable peptides"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3949 , varwidth = boxplot_varwidth
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3950 , sub = paste(boxplot_sub, "Box widths reflect number of peptides for sample")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3951 , xlab = "Sample"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3952 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3953 , col = const_boxplot_fill
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3954 , notch = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3955 , ylim = ylim
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3956 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3957
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3958 if (show_stripchart) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3959 # Points
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3960 # ref: https://r-charts.com/distribution/add-points-boxplot/
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3961 # NA values are not plotted
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3962 stripchart(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3963 blue_dots, # Data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3964 method = "jitter", # Random noise
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3965 jitter = const_stripchart_jitter,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3966 pch = 19, # Pch symbols
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3967 cex = const_stripchart_cex, # Size of symbols reduced
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3968 col = "lightblue", # Color of the symbol
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3969 vertical = TRUE, # Vertical mode
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3970 add = TRUE # Add it over
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3971 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3972 stripchart(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3973 red_dots, # Data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3974 method = "jitter", # Random noise
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3975 jitter = const_stripchart_jitter,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3976 pch = 19, # Pch symbols
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3977 cex = const_stripchart_cex, # Size of symbols reduced
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3978 col = "red", # Color of the symbol
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3979 vertical = TRUE, # Vertical mode
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3980 add = TRUE # Add it over
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3981 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3982
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3983 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3984 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3985 ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3986
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3987 ```{r echo = FALSE, fig.dim = c(9, 5.5), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3988 if (sum(is.na(quant_data)) > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3989 # show measured values in blue on left half-violin plot
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3990 cat("\\leavevmode\n\\quad\n\n\\quad\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3991 old_par <- par(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3992 mai = par("mai") + c(g_ppep_distrib_ctl$mai_bottom, 0, 0, 0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3993 cex.axis = g_ppep_distrib_ctl$axis,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3994 cex.lab = 1.2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3995 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3996 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3997 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3998 vioplot::vioplot(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3999 x = lapply(blue_dots, function(x) x[!is.na(x)]),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4000 col = "lightblue1",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4001 side = "left",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4002 plotCentre = "line",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4003 ylim = ylim_save,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4004 main = "Distributions of observed and imputed data",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4005 sub = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4006 las = 2,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4007 xlab = NULL,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4008 ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4009 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4010 title(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4011 sub = "Light blue = observed data; Pink = imputed data",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4012 cex.sub = 1.0,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4013 line = g_ppep_distrib_ctl$xlab_line + 1
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4014 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4015 title(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4016 xlab = "Sample",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4017 line = g_ppep_distrib_ctl$xlab_line
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4018 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4019 red_violins <- lapply(red_dots, function(x) x[!is.na(x)])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4020 cols_to_delete <- c()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4021 for (ix in seq_len(length(red_violins))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4022 if (length(red_violins[[ix]]) < 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4023 cols_to_delete <- c(cols_to_delete, ix)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4024 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4025 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4026 # destroy any unimputable columns
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4027 if (!is.null(cols_to_delete)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4028 red_violins <- red_violins[-cols_to_delete]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4029 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4030 # plot imputed values in red on right half-violin plot
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4031 vioplot::vioplot(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4032 x = red_violins,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4033 col = "lightpink1",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4034 side = "right",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4035 plotCentre = "line",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4036 add = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4037 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4038
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4039 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4040 finally = par(old_par)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4041 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4042
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4043 # density plot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4044 cat("\\leavevmode\n\n\n\n\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4045 if (can_plot_before_after_imp) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4046 ylim <- c(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4047 0,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4048 max(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4049 if (is.list(d_combined)) d_combined$y else d_combined,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4050 if (is.list(d_original)) d_original$y else d_original,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4051 if (is.list(d_imputed)) d_imputed$y else d_imputed,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4052 na.rm = TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4053 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4054 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4055 plot(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4056 d_combined,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4057 ylim = ylim,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4058 sub =
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4059 paste(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4060 "Blue = data before imputation; Red = imputed data;",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4061 "Black = combined"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4062 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4063 main = "Density of peptide intensity before and after imputation",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4064 xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4065 ylab = "Probability density"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4066 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4067 lines(d_original, col = "blue")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4068 lines(d_imputed, col = "red")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4069 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4070 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4071 "There are too few points to plot the density of peptide intensity",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4072 "before and after imputation."
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4073 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4074 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4075 cat("\\leavevmode\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4076 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4077 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4078
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4079 # Quantile Normalization
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4080
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4081 The excellent `normalize.quantiles` function from
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4082 *[the `preprocessCore` Bioconductor package](http://bioconductor.org/packages/release/bioc/html/preprocessCore.html)*
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4083 performs "quantile normalization" as described Bolstad *et al.* (2003),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4084 DOI *[10.1093/bioinformatics/19.2.185](https://doi.org/10.1093%2Fbioinformatics%2F19.2.185)*
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4085 and its supplementary material [http://bmbolstad.com/misc/normalize/normalize.html](http://bmbolstad.com/misc/normalize/normalize.html),
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4086 i.e., it assumes that the goal is to detect
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4087 subtle differences among grossly similar samples (having similar distributions)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4088 by equalizing intra-quantile quantitations^[Unfortunately,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4089 one software library upon which `preprocessCore` depends
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4090 *[suffers from a concurrency defect](https://support.bioconductor.org/p/122925/#9135989)*
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4091 that requires that a specific, non-concurrent version of the library (`openblas` version $0.3.3$) be
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4092 installed. The installation command equivalent to what was used to install the library to produce the results presented here is:
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4093 \linebreak
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4094 ` conda install bioconductor-preprocesscore openblas=0.3.3`].
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4095
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4096
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4097 <!--
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4098 # Apply quantile normalization using preprocessCore::normalize.quantiles
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4099 # ---
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4100 # tool repository: http://bioconductor.org/packages/release/bioc/html/preprocessCore.html
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4101 # except this: https://support.bioconductor.org/p/122925/#9135989
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4102 # says to install it like this:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4103 # ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4104 # BiocManager::install("preprocessCore", configure.args="--disable-threading", force = TRUE, lib=.libPaths()[1])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4105 # ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4106 # conda installation (necessary because of a bug in recent openblas):
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4107 # conda install bioconductor-preprocesscore openblas=0.3.3
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4108 # ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4109 # ---
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4110 # normalize.quantiles {preprocessCore} -- Quantile Normalization
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4111 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4112 # Description:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4113 # Using a normalization based upon quantiles, this function normalizes a
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4114 # matrix of probe level intensities.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4115 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4116 # THIS FUNCTIONS WILL HANDLE MISSING DATA (ie NA values), based on the
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4117 # assumption that the data is missing at random.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4118 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4119 # Usage:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4120 # normalize.quantiles(x, copy = TRUE, keep.names = FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4121 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4122 # Arguments:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4123 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4124 # - x: A matrix of intensities where each column corresponds to a chip and each row is a probe.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4125 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4126 # - copy: Make a copy of matrix before normalizing. Usually safer to work with a copy,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4127 # but in certain situations not making a copy of the matrix, but instead normalizing
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4128 # it in place will be more memory friendly.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4129 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4130 # - keep.names: Boolean option to preserve matrix row and column names in output.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4131 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4132 # Details:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4133 # This method is based upon the concept of a quantile-quantile plot extended to n dimensions.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4134 # No special allowances are made for outliers. If you make use of quantile normalization
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4135 # please cite Bolstad et al, Bioinformatics (2003).
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4136 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4137 # This functions will handle missing data (ie NA values), based on
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4138 # the assumption that the data is missing at random.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4139 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4140 # Note that the current implementation optimizes for better memory usage
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4141 # at the cost of some additional run-time.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4142 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4143 # Value: A normalized matrix.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4144 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4145 # Author: Ben Bolstad, bmbolstad.com
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4146 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4147 # References
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4148 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4149 # - Bolstad, B (2001) Probe Level Quantile Normalization of High Density Oligonucleotide
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4150 # Array Data. Unpublished manuscript http://bmbolstad.com/stuff/qnorm.pdf
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4151 #
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4152 # - Bolstad, B. M., Irizarry R. A., Astrand, M, and Speed, T. P. (2003) A Comparison of
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4153 # Normalization Methods for High Density Oligonucleotide Array Data Based on Bias
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4154 # and Variance. Bioinformatics 19(2), pp 185-193. DOI 10.1093/bioinformatics/19.2.185
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4155 # http://bmbolstad.com/misc/normalize/normalize.html
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4156 # ...
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4157 -->
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4158 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4159
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4160 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp)), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4161 if (nrow(quant_data_imp) > 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4162 quant_data_imp_qn <- preprocessCore::normalize.quantiles(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4163 as.matrix(quant_data_imp), keep.names = TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4164 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4165 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4166 quant_data_imp_qn <- as.matrix(quant_data_imp)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4167 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4168
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4169 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp_qn)), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4170
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4171 quant_data_imp_qn <- as.data.frame(quant_data_imp_qn)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4172 write_debug_file(quant_data_imp_qn)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4173
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4174 quant_data_imp_qn_log <- log10(quant_data_imp_qn)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4175 write_debug_file(quant_data_imp_qn_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4176
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4177 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp_qn_log)), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4178 if (print_nb_messages) nbe(see_variable(ncol(quant_data_imp_qn_log)), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4179
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4180 quant_data_imp_qn_ls <- t(scale(t(log10(quant_data_imp_qn))))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4181
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4182 sel <- row_apply(quant_data_imp_qn_ls, any_nan)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4183 quant_data_imp_qn_ls2 <- quant_data_imp_qn_ls
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4184
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4185 quant_data_imp_qn_ls2 <- quant_data_imp_qn_ls2[which(sel), ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4186 quant_data_imp_qn_ls2 <- as.data.frame(quant_data_imp_qn_ls2)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4187
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4188 quant_data_imp_qn_ls <- as.data.frame(quant_data_imp_qn_ls)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4189
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4190 write_debug_file(quant_data_imp_qn_ls)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4191 write_debug_file(quant_data_imp_qn_ls2)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4192
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4193 # Create data.frame used by ANOVA analysis
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4194 data_table_imp_qn_lt <- cbind(full_data[1:9], quant_data_imp_qn_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4195 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4196
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4197 ## Are normalized, imputed, log-transformed sample distributions similar?
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4198
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4199 ```{r echo = FALSE, fig.dim = c(9, 6.5), results = 'asis'}
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4200
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4201 # Save unimputed quant_data_log for plotting below
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4202 unimputed_quant_data_log <- quant_data_log
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4203
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4204 # log10 transform (after preparing for zero values,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4205 # which should never happen...)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4206 quant_data_imp_qn[quant_data_imp_qn == 0] <- .000000001
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4207 quant_data_log <- log10(quant_data_imp_qn)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4208
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4209 how_many_peptides <- nrow(quant_data_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4210
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4211 if ((how_many_peptides) > 0) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4212 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4213 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4214 "Intensities for %d peptides:\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4215 how_many_peptides
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4216 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4217 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4218 cat("\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4219
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4220
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4221 # data visualization
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4222 if (TRUE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4223
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4224 my_ppep_distrib_bxp(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4225 x = quant_data_log
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4226 , sample_name_grow = sample_name_grow
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4227 , main = "Peptide intensities for each sample"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4228 , varwidth = boxplot_varwidth
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4229 , sub = NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4230 , xlab = "Sample"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4231 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4232 , col = const_boxplot_fill
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4233 , notch = boxplot_notch
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4234 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4235
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4236 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4237
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4238 old_par <- par(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4239 mai = par("mai") + c(0.5, 0, 0, 0)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4240 , oma = par("oma") + c(0.5, 0, 0, 0)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4241 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4242 # ref: https://r-charts.com/distribution/add-points-boxplot/
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4243 # Vertical plot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4244 colnames(quant_data_log) <- sample_name_matches
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4245 boxplot(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4246 quant_data_log
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4247 , las = 2
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4248 , cex.axis = 0.9 * sample_name_grow
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4249 , col = const_boxplot_fill
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4250 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4251 , xlab = "Sample"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4252 , notch = boxplot_notch
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4253 , varwidth = boxplot_varwidth
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4254 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4255 par(old_par)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4256 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4257 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4258 cat("There are no peptides to plot\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4259 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4260
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4261 cat("\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4262
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4263 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4264
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4265 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 4), results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4266 if (nrow(quant_data_log) > 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4267 quant_data_log_stack <- stack(quant_data_log)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4268 ggplot2::ggplot(quant_data_log_stack, ggplot2::aes(x = values)) +
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4269 ggplot2::xlab(latex2exp::TeX("$log_{10}$(peptide intensity)")) +
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4270 ggplot2::ylab("Probability density") +
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4271 ggplot2::geom_density(ggplot2::aes(group = ind, colour = ind), na.rm = TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4272 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4273 cat("No density plot because there are fewer than two peptides to plot.\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4274 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4275 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4276 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4277 cat("\\leavevmode\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4278 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4279
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4280 # ANOVA Analysis
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4281
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4282 ## Assignment of $p$-value and quality score
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4283
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4284 For each phosphopeptide, ANOVA analysis was performed to compute a $p$-value representing the evidence against the "null hypothesis" ($H_0$) that the intensity does not vary significantly among sample groups.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4285
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4286 However, because as more and more phosphopeptides are tested, there is increasd probability that, by random chance, a given peptide will have a $p$-value that appears to indicate significance. For this reason, the $p$-values were adjusted by applying the False Discovery Rate (FDR) correction from Benjamini and Hochberg (1995) [doi:10.1111/j.2517-6161.1995.tb02031.x](https:/doi.org/10.1111/j.2517-6161.1995.tb02031.x).
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4287
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4288 Furthermore, to give more weight to phosphopeptides having fewer missing values, an (arbitrarily defined) quality score was assigned to each, defined as:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4289
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4290 $$
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4291 \textit{quality}_j
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4292 = \frac{1 + o_{j}}{v_{j}(1 + o_{j}) + 0.005}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4293 $$
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4294
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4295 where:
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4296
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4297 - $o_j$ is the minimum number of non-missing observations per sample group for substrate $j$ for all sample groups, and
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4298 - $v_j$ is the FDR-adjusted ANOVA $p$-value for substrate $j$.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4299
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4300
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4301 ```{r, echo = FALSE, results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4302 cat("\\newpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4303
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4304 # Make new data frame containing only Phosphopeptides
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4305 # to connect preANOVA to ANOVA (connect_df)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4306 connect_df <- data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4307 data_table_imp_qn_lt$Phosphopeptide
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4308 , data_table_imp_qn_lt[, first_data_column]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4309 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4310 colnames(connect_df) <- c("Phosphopeptide", "Intensity")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4311 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4312
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4313 ```{r anova, echo = FALSE, fig.dim = c(10, 12), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4314 g_can_run_ksea <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4315 old_oma <- par("oma")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4316 if (count_of_treatment_levels < 2) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4317 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4318 "ERROR!!!! Cannot perform ANOVA analysis",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4319 "(see next page)\\newpage\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4320 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4321 cat(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4322 "ERROR: ANOVA analysis",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4323 "requires two or more factor levels!\n\n\n"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4324 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4325
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4326 cat("\n\n\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4327 cat("Unparsed sample names are:\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4328 "\\begin{quote}\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4329 paste(names(quant_data_imp_qn_log), collapse = "\n\n\n"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4330 "\n\\end{quote}\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4331
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4332 regex_sample_names <- latex_printable_control_seqs(regex_sample_names)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4333
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4334 cat("\\leavevmode\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4335 cat("Parsing rule for SampleNames is",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4336 "\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4337 "\\text{'",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4338 regex_sample_names,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4339 "'}\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4340 sep = ""
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4341 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4342
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4343 cat("\nParsed sample names are:\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4344 "\\begin{quote}\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4345 paste(sample_name_matches, collapse = "\n\n\n"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4346 "\n\\end{quote}\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4347
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4348 regex_sample_grouping <- latex_printable_control_seqs(regex_sample_grouping)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4349
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4350 cat("\\leavevmode\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4351 cat("Parsing rule for SampleGrouping is",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4352 "\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4353 "\\text{'",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4354 regex_sample_grouping,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4355 "'}\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4356 sep = ""
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4357 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4358
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4359 cat("\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4360 cat("Sample group assignments are:\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4361 "\\begin{quote}\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4362 paste(regmatches(sample_name_matches, rx_match), collapse = "\n\n\n"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4363 "\n\\end{quote}\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4364
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4365 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4366
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4367 if (print_nb_messages) nbe("computing p_value_data_anova_ps\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4368 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp_qn_log)), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4369 if (print_nb_messages) nbe(see_variable(ncol(quant_data_imp_qn_log)), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4370 if (print_nb_messages) nbe(see_variable(quant_data_imp_qn_log[, ".NE.7C"]), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4371 if (print_nb_messages) nbe(see_variable(quant_data_imp_qn_log), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4372 if (print_nb_messages) nbe(see_variable(anova_func), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4373 if (print_nb_messages) nbe(see_variable(smpl_trt), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4374 if (print_nb_messages) nbe(see_variable(one_way_all_categories), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4375 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4376 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4377 p_value_data_anova_ps <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4378 row_apply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4379 quant_data_imp_qn_log,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4380 anova_func,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4381 grouping_factor = smpl_trt,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4382 one_way_f = one_way_all_categories
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4383 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4384 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4385 error = function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4386 mesg <- paste("Could not compute ANOVA because", e$message)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4387 cat("\n\n", mesg, "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4388 param_df_noexit(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4389 sink(stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4390 cat("\n\n", mesg, "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4391 values <- paste(param_df$parameter, "=", param_df$value, collapse = "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4392 cat(values)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4393 sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4394 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4395 exit(code = 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4396 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4397 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4398 if (print_nb_messages) nbe(see_variable(p_value_data_anova_ps), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4399
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4400 p_value_data_anova_ps_fdr <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4401 p.adjust(p_value_data_anova_ps, method = "fdr")
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4402 my_ppep_v <- full_data[, 1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4403 p_value_data <- list(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4404 phosphopeptide = my_ppep_v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4405 raw_anova_p = p_value_data_anova_ps,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4406 fdr_adjusted_anova_p = p_value_data_anova_ps_fdr,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4407 missing_values = rowSums(is.na(quant_data)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4408 min_group_obs_count = min_group_obs_count
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4409 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4410 p_value_data <- data.frame(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4411 phosphopeptide = my_ppep_v,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4412 raw_anova_p = p_value_data_anova_ps,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4413 fdr_adjusted_anova_p = p_value_data_anova_ps_fdr,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4414 missing_values = rowSums(is.na(quant_data)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4415 min_group_obs_count = min_group_obs_count
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4416 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4417 p_value_data$quality <- 1.0 / with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4418 p_value_data,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4419 fdr_adjusted_anova_p + 0.005 / (1 + min_group_obs_count)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4420 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4421
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4422 p_value_data$ranking <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4423 with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4424 p_value_data,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4425 switch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4426 g_intensity_hm_criteria,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4427 "quality" = order(-quality),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4428 "na_count" = order(missing_values, fdr_adjusted_anova_p),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4429 # the default is "p_value"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4430 order(fdr_adjusted_anova_p)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4431 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4432 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4433 p_value_data <- p_value_data[p_value_data$ranking, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4434
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4435 write.table(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4436 p_value_data,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4437 file = "p_value_data.txt",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4438 sep = "\t",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4439 col.names = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4440 row.names = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4441 quote = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4442 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4443
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4444
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4445 # output ANOVA file to constructed filename,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4446 # e.g. "Outputfile_pST_ANOVA_STEP5.txt"
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4447 # becomes "Outputfile_pST_ANOVA_STEP5_FDR0.05.txt"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4448
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4449 # Re-output datasets to include p-values
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4450 metadata_plus_p <- cbind(full_data[1:9], p_value_data[, 2:ncol(p_value_data)])
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4451 write.table(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4452 cbind(metadata_plus_p, quant_data_imp),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4453 file = imputed_data_filename,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4454 sep = "\t",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4455 col.names = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4456 row.names = FALSE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4457 quote = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4458 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4459
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4460 write.table(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4461 cbind(metadata_plus_p, quant_data_imp_qn_log),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4462 file = imp_qn_lt_data_filenm,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4463 sep = "\t",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4464 col.names = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4465 row.names = FALSE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4466 quote = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4467 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4468
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4469
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4470 first_page_suppress <- 1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4471 number_of_peptides_found <- 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4472 cutoff <- val_fdr[1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4473 for (cutoff in val_fdr) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4474 #loop through FDR cutoffs
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4475 if (number_of_peptides_found > g_intensity_hm_rows - 1) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4476 cat("\\leavevmode\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4477 break
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4478 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4479
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4480 bool_1 <- (p_value_data$fdr_adjusted_anova_p < cutoff)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4481 bool_2 <- (p_value_data$min_group_obs_count >= g_intensity_min_per_class)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4482 g_can_run_ksea <- g_can_run_ksea || (sum(bool_2) > 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4483 bool_4 <- (p_value_data$quality >= params$minQuality)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4484 bool_3 <- as.logical(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4485 as.integer(bool_1) *
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4486 as.integer(bool_2) *
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4487 as.integer(bool_4)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4488 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4489 if (print_trace_messages) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4490 if (length(bool_1) > 30) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4491 cat_variable(bool_1, force_str = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4492 cat_variable(bool_2, force_str = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4493 cat_variable(bool_3, force_str = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4494 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4495 cat_variable(bool_1, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4496 cat_variable(bool_2, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4497 cat_variable(bool_3, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4498 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4499 cat_variable(length(bool_3), digits = 0, suffix = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4500 cat_variable(sum(bool_3), digits = 0, suffix = "\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4501 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4502
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4503 filtered_p <-
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4504 p_value_data[bool_3, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4505 filtered_p <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4506 filtered_p[!is.na(filtered_p$phosphopeptide), , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4507
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4508 if (print_trace_messages)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4509 cat_variable(filtered_p, force_str = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4510
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4511 have_remaining_peptides <- sum(bool_3, na.rm = TRUE) > 0
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4512 filter_result_string <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4513 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4514 "%s, %s of %0.0f peptides remained having both %s and %s.\n\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4515 "After filtering for ANOVA results",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4516 if (have_remaining_peptides)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4517 as.character(sum(bool_3, na.rm = TRUE))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4518 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4519 "none",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4520 length(bool_3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4521 sprintf("adjusted p-value < %s", as.character(signif(cutoff, 2))),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4522 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4523 "more than %0.0f observations in some groups",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4524 max(0, g_intensity_min_per_class - 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4525 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4526 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4527
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4528 filtered_data_filtered <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4529 quant_data_imp_qn_log[
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4530 rownames(filtered_p),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4531 , drop = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4532 ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4533 # order by p-value
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4534 filtered_data_filtered <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4535 filtered_data_filtered[
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4536 order(filtered_p$fdr_adjusted_anova_p),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4537 , drop = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4538 ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4539
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4540 if (have_remaining_peptides && nrow(filtered_p) > 0 && nrow(filtered_data_filtered) > 0) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4541 if (first_page_suppress == 1) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4542 first_page_suppress <- 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4543 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4544 cat("\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4545 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4546 latex_samepage({
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4547 cat(filter_result_string)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4548 if (nrow(filtered_data_filtered) > 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4549 cat(subsection_header(sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4550 "Intensity distributions for %d phosphopeptides\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4551 nrow(filtered_data_filtered)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4552 )))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4553 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4554 cat(subsection_header(sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4555 "Intensity distribution for one phosphopeptide (%s)\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4556 rownames(filtered_data_filtered)[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4557 )))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4558 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4559 }) # end latex_samepage
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4560
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4561 old_par <- par(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4562 mai = (par("mai") + c(0.7, 0, 0, 0)) * c(1, 1, 0.3, 1),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4563 oma = old_oma * c(1, 1, 0.3, 1),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4564 cex.main = 0.9,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4565 cex.axis = 0.7,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4566 fin = c(9, 7.25)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4567 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4568 # Vertical plot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4569 colnames(filtered_data_filtered) <- sample_name_matches
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4570 tryCatch(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4571 boxplot(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4572 filtered_data_filtered,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4573 main = "Imputed, normalized intensities", # no line plot
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4574 las = 2,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4575 cex.axis = 0.9 * sample_name_grow,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4576 col = const_boxplot_fill,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4577 ylab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4578 notch = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4579 varwidth = boxplot_varwidth
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4580 ),
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4581 error = function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4582 print(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4583 cat_margins()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4584 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4585
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4586 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4587 par(old_par)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4588 } else {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4589 cat(sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4590 "%s < %0.2f\n\n\n\n\n",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4591 "No peptides were found to have cutoff adjusted p-value",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4592 cutoff
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4593 ))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4594 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4595
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4596 if (have_remaining_peptides && nrow(filtered_data_filtered) > 0) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4597 # Add Phosphopeptide column to anova_filtered table
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4598 # The assumption here is that the first intensity is unique;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4599 # this is a hokey assumption but almost definitely will
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4600 # be true in the real world unless there is a computation
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4601 # error upstream.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4602 anova_filtered_merge <- base::merge(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4603 x = connect_df,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4604 y = filtered_data_filtered,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4605 by.x = "Intensity",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4606 by.y = 1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4607 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4608 anova_filtered_merge_order <- rownames(filtered_p)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4609
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4610 anova_filtered <- data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4611 ppep = anova_filtered_merge$Phosphopeptide,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4612 intense = anova_filtered_merge$Intensity,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4613 data = anova_filtered_merge[, 2:number_of_samples + 1]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4614 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4615 colnames(anova_filtered) <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4616 c("Phosphopeptide", colnames(filtered_data_filtered))
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4617
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4618 # Merge qualitative columns into the ANOVA data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4619 output_table <- data.frame(anova_filtered$Phosphopeptide)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4620 output_table <- base::merge(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4621 x = output_table,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4622 y = data_table_imp_qn_lt,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4623 by.x = "anova_filtered.Phosphopeptide",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4624 by.y = "Phosphopeptide"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4625 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4626
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4627 # Produce heatmap to visualize significance and the effect of imputation
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4628
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4629 cat_hm_heading <- function(m, cutoff) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4630 if (nrow(m) > g_intensity_hm_rows) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4631 cat("\\clearpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4632 cat(subsection_header(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4633 paste(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4634 sprintf("Heatmap for the %d most-significant peptides",
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4635 g_intensity_hm_rows),
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4636 sprintf("whose adjusted p-value < %0.2f\n", cutoff)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4637 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4638 ))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4639 } else {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4640 if (nrow(m) == 0) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4641 return(FALSE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4642 } else {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4643 cat(subsection_header(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4644 paste(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4645 sprintf("Heatmap for %d usable peptide genes whose", nrow(m)),
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4646 sprintf("adjusted p-value < %0.2f\n", cutoff)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4647 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4648 ))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4649 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4650 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4651 cat("\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4652 cat("\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4653 return(TRUE)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4654 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4655
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4656 # construct matrix with appropriate rownames
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4657 m <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4658 as.matrix(unimputed_quant_data_log[anova_filtered_merge_order, ])
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4659 nrow_m <- nrow(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4660 ncol_m <- ncol(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4661 if (nrow_m > 0) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4662 rownames_m <- rownames(m)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4663 q <- data.frame(pepname = rownames_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4664 g <- sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4665 SELECT q.pepname, substr(met.Gene_Name, 1, 30) AS gene_name
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4666 FROM q, metadata_plus_p AS met
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4667 WHERE q.pepname = met.Phosphopeptide
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4668 ORDER BY q.rowid
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4669 ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4670 tmp <- sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4671 X = seq_len(nrow(g)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4672 FUN = function(i) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4673 pre <- strsplit(g$gene_name[i], "; ")[[1]]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4674 rslt <- paste(unique(pre), sep = "; ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4675 return(rslt)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4676 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4677 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4678 tmp <- unlist(tmp)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4679 tmp <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4680 make.names(tmp, unique = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4681 tmp <- sub(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4682 "No_Gene_Name",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4683 "not_found",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4684 tmp,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4685 fixed = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4686 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4687 ten_trunc_names <- trunc_ppep(rownames_m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4688 tmp <- sapply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4689 X = seq_len(nrow_m),
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4690 FUN = function(i) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4691 sprintf(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4692 "(%s) %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4693 tmp[i],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4694 ten_trunc_names[i]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4695 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4696 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4697 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4698 rownames(m) <- tmp
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4699 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4700 # draw the heading and heatmap
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4701 if (nrow_m > 0) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4702 number_of_peptides_found <-
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4703 ppep_heatmap(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4704 m = m,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4705 cutoff = cutoff,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4706 hm_heading_function = cat_hm_heading,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4707 hm_main_title =
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4708 "log(intensities), row-scaled, unimputed, unnormalized",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4709 suppress_row_dendrogram = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4710 master_cex = 0.35,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4711 sepcolor = "black",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4712 colsep = sample_colsep
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4713 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4714 if (number_of_peptides_found > 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4715 cat("\\leavevmode\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4716 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4717 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4718 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4719 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4720 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4721 cat(filter_result_string)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4722 cat("\\leavevmode\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4723
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4724 if (!g_can_run_ksea) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4725 errmsg <- paste("Cannot proceed with KSEA analysis",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4726 "because too many values are missing.")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4727 if (FALSE) cat0(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4728 errmsg,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4729 "\\stepcounter{offset}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4730 "\\stepcounter{offset}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4731 "\\stepcounter{offset}\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4732 " in ",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4733 table_href(),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4734 ".\n\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4735 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4736 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4737 if (print_nb_messages) nbe(see_variable(p_value_data))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4738 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4739 if (print_nb_messages) nbe(see_variable(p_value_data))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4740
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4741 display_p_value_data <- p_value_data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4742 display_p_value_data$raw_anova_p <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4743 sprintf("%0.3g", display_p_value_data$raw_anova_p)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4744 display_p_value_data$fdr_adjusted_anova_p <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4745 sprintf("%0.3g", display_p_value_data$fdr_adjusted_anova_p)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4746 display_p_value_data$quality <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4747 sprintf("%0.3g", display_p_value_data$quality)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4748
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4749 headers_1st_line <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4750 c("", "Raw ANOVA", "FDR-adj.", "Missing", "Min. #", "", "")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4751 headers_2nd_line <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4752 c("Phosphopeptide", "p-value", "p-value", "values", "group-obs", "Quality", "Ranking")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4753 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4754 x = display_p_value_data,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4755 tabstops = c(2.75, 0.80, 0.80, 0.5, 0.6, 0.60),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4756 use_subsubsection_header = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4757 headings = c(headers_1st_line, headers_2nd_line),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4758 caption = "ANOVA results"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4759
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4760 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4761 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4762 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4763 x = save_sample_treatment_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4764 tabstops = c(1.25, 1.25),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4765 caption = "Sample classes",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4766 use_subsubsection_header = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4767 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4768 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4769 knitr::knit_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4770 return(invisible(-1))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4771 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4772
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4773 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4774
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4775 ```{r sqlite, echo = FALSE, fig.dim = c(9, 10), results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4776
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4777 if (g_can_run_ksea && count_of_treatment_levels > 1) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4778 # Prepare two-way contrasts with adjusted p-values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4779 # Strategy:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4780 # - use imputed, log-transformed data:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4781 # - remember this when computing log2(fold-change)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4782 # - each contrast is between a combination of trt levels
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4783 # - for each contrast, compute samples that are members
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4784 # - compute one-way test:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4785 # - use `oneway.test` (Welch test) if numbers of samples
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4786 # are not equivalent between trt levels
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4787 # - otherwise, aov is fine but offers no advantage
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4788 # - adjust p-value, assuming that
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4789 # (# of pppeps)*(# of contrasts) tests were performed
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4790
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4791 # Each contrast is between a combination of trt levels
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4792 m2 <- combn(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4793 x = seq_len(length(levels(smpl_trt))),
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4794 m = 2,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4795 simplify = TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4796 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4797 contrast_count <- ncol(m2)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4798
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4799 # For each contrast, compute samples that are members
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4800 # - local function to construct a data.frame for each contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4801 # - the contrast in the first "column"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4802 f_m2 <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4803 function(cntrst, lvl1, lvl2) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4804 return(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4805 data.frame(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4806 contrast = cntrst,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4807 level = smpl_trt[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4808 smpl_trt %in%
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4809 levels(smpl_trt)[c(lvl1, lvl2)]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4810 ],
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4811 label = sample_name_matches[
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4812 smpl_trt %in%
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4813 levels(smpl_trt)[c(lvl1, lvl2)]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4814 ]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4815 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4816 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4817 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4818 # - compute a df for each contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4819 sample_level_dfs <- lapply(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4820 X = 1:contrast_count,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4821 FUN = function(i) f_m2(i, m2[1, i], m2[2, i])
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4822 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4823 # - compute a single df for all contrasts
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4824 combined_contrast_df <- Reduce(f = rbind, x = sample_level_dfs)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4825
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4826 # - dispose objects to free resources
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4827 rm(sample_level_dfs)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4828
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4829 # - write the df to a DB for later join-per-contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4830 db <- RSQLite::dbConnect(RSQLite::SQLite(), ksea_app_prep_db)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4831
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4832 RSQLite::dbWriteTable(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4833 conn = db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4834 name = "contrast",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4835 value = combined_contrast_df,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4836 overwrite = TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4837 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4838
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4839 # Create UK for insert
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4840 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4841 CREATE UNIQUE INDEX IF NOT EXISTS contrast__uk__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4842 ON contrast(contrast, label);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4843 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4844 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4845 # Create indexes for join
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4846 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4847 -- index for join in contrast_ppep_smpl_qnlt on a.label < b.label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4848 CREATE INDEX IF NOT EXISTS contrast__label__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4849 ON contrast(label);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4850 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4851 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4852 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4853 -- index for joining two contrast_lvl_ppep_avg_quant on contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4854 CREATE INDEX IF NOT EXISTS contrast__contrast__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4855 ON contrast(contrast);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4856 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4857 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4858 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4859 -- index for joining two contrast_lvl_ppep_avg_quant on phophospep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4860 CREATE INDEX IF NOT EXISTS contrast__level__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4861 ON contrast(level);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4862 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4863 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4864 # - dispose objects to free resources
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4865 rm(combined_contrast_df)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4866
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4867 # Use imputed, log-transformed data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4868 # - remember that this was donoe when computing log2(fold-change)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4869 # - melt data matrix for use in later join-per-contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4870 casted <- cbind(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4871 data.frame(vrbl = rownames(quant_data_imp_qn_log)),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4872 quant_data_imp_qn_log
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4873 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4874 quant_data_imp_qn_log_melted <- reshape2::melt(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4875 casted,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4876 id.vars = "vrbl"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4877 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4878 colnames(quant_data_imp_qn_log_melted) <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4879 c("phosphopep", "sample", "quant")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4880 # - dispose objects to free resources
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4881 rm(casted)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4882
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4883 # - write the df to a DB for use in later join-per-contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4884 RSQLite::dbWriteTable(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4885 conn = db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4886 name = "ppep_smpl_qnlt",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4887 value = quant_data_imp_qn_log_melted,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4888 overwrite = TRUE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4889 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4890 # Create UK for insert
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4891 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4892 CREATE UNIQUE INDEX IF NOT EXISTS ppep_smpl_qnlt__uk__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4893 ON ppep_smpl_qnlt(phosphopep, sample);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4894 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4895 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4896 # Create index for join
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4897 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4898 -- index for join in contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4899 CREATE INDEX IF NOT EXISTS ppep_smpl_qnlt__sample__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4900 ON ppep_smpl_qnlt(sample);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4901 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4902 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4903 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4904 -- index for joining two contrast_lvl_ppep_avg_quant on phopho.pep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4905 CREATE INDEX IF NOT EXISTS ppep_smpl_qnlt__phosphopep__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4906 ON ppep_smpl_qnlt(phosphopep);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4907 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4908 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4909 # - dispose objects to free resources
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4910 rm(quant_data_imp_qn_log_melted)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4911
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4912 # - drop views if exist
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4913 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4914 -- drop view dependent on contrast_lvl_ppep_avg_quant
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4915 DROP VIEW IF EXISTS v_contrast_log2_fc;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4916 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4917 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4918 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4919 -- drop table dependent on contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4920 DROP TABLE IF EXISTS contrast_lvl_ppep_avg_quant;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4921 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4922 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4923 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4924 DROP TABLE IF EXISTS contrast_lvl_lvl_metadata;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4925 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4926 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4927 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4928 DROP VIEW IF EXISTS v_contrast_lvl_metadata;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4929 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4930 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4931 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4932 -- drop view dependent on contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4933 DROP VIEW IF EXISTS v_contrast_lvl_ppep_avg_quant;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4934 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4935 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4936 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4937 DROP VIEW IF EXISTS v_contrast_lvl_lvl;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4938 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4939 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4940 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4941 -- drop view upon which other views depend
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4942 DROP VIEW IF EXISTS contrast_ppep_smpl_qnlt;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4943 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4944 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4945 # - create view
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4946 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4947 -- view contrast_ppep_smpl_qnlt is used for each phopshopep to
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4948 -- compute p-value for test of trt effect for two trt levels
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4949 CREATE VIEW contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4950 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4951 SELECT contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4952 level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4953 phosphopep,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4954 sample,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4955 quant
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4956 FROM contrast AS c,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4957 ppep_smpl_qnlt AS q
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4958 WHERE q.sample = c.label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4959 ORDER BY contrast, level, phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4960 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4961 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4962 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4963 # - create simplification views
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4964 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4965 CREATE VIEW v_contrast_lvl_metadata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4966 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4967 SELECT contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4968 level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4969 group_concat(label, ';') AS samples
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4970 FROM contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4971 GROUP BY contrast, level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4972 /* view v_contrast_lvl_metadata is used
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4973 to simplify creation of table contrast_lvl_lvl_metadata */
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4974 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4975 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4976 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4977 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4978 CREATE VIEW v_contrast_lvl_ppep_avg_quant
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4979 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4980 SELECT contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4981 level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4982 phosphopep,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4983 avg(quant) AS avg_quant
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4984 FROM contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4985 GROUP BY contrast, level, phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4986 /* view v_contrast_lvl_ppep_avg_quant is used
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4987 to simplify view v_contrast_log2_fc */
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4988 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4989 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4990 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4991
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4992 # - create contrast-metadata table
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4993 if (print_nb_messages) nbe("CREATE TABLE contrast_lvl_lvl_metadata")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4994 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4995 CREATE TABLE contrast_lvl_lvl_metadata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4996 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4997 SELECT DISTINCT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4998 a.contrast AS ab_contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4999 a.level AS a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5000 b.level AS b_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5001 a.samples AS a_samples,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5002 b.samples AS b_samples,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5003 'log2(level_'||a.level||'/level_'||b.level||')'
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5004 AS fc_description
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5005 FROM v_contrast_lvl_metadata AS a,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5006 v_contrast_lvl_metadata AS b
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5007 WHERE a.contrast = b.contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5008 AND a.level > b.level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5009 /* view v_contrast_lvl_lvl is used
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5010 to simplify view v_contrast_log2_fc */
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5011 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5012 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5013 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5014 # - create pseudo-materialized view table
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5015 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5016 CREATE VIEW v_contrast_lvl_lvl
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5017 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5018 SELECT DISTINCT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5019 a.contrast AS ab_contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5020 a.level AS a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5021 b.level AS b_level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5022 FROM contrast AS a,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5023 contrast AS b
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5024 WHERE a.contrast = b.contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5025 AND a.level > b.level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5026 /* view v_contrast_lvl_lvl is used
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5027 to simplify view v_contrast_log2_fc */
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5028 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5029 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5030 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5031
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5032 # - create view to compute log2(fold-change)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5033 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5034 CREATE VIEW v_contrast_log2_fc
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5035 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5036 SELECT ab.ab_contrast AS contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5037 m.a_level AS a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5038 c.avg_quant AS a_quant,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5039 m.a_samples AS a_samples,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5040 ab.b_level AS b_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5041 d.avg_quant AS b_quant,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5042 m.b_samples AS b_samples,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5043 m.fc_description AS fc_description,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5044 3.32193 * ( d.avg_quant - c.avg_quant) AS log2_fc,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5045 d.phosphopep AS phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5046 FROM contrast_lvl_lvl_metadata AS m,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5047 v_contrast_lvl_ppep_avg_quant AS d,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5048 v_contrast_lvl_lvl AS ab
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5049 INNER JOIN v_contrast_lvl_ppep_avg_quant AS c
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5050 ON c.contrast = ab.ab_contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5051 AND c.level = ab.a_level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5052 WHERE d.contrast = ab.ab_contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5053 AND m.ab_contrast = ab.ab_contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5054 AND d.level = ab.b_level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5055 AND d.phosphopep = c.phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5056 /* view to compute log2(fold-change) */
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5057 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5058 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5059 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5060
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5061 # For each contrast, compute samples that are members
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5062 # compute one-way test:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5063 # - use `oneway.test` (Welch test) if numbers of samples
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5064 # are not equivalent between trt levels
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5065 # - otherwise, aov is fine but offers no advantage
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5066 for (contrast in contrast_count:2) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5067 invisible(contrast)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5068 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5069 for (contrast in 1:contrast_count) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5070 contrast_df <- sqldf::sqldf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5071 x = paste0("
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5072 SELECT level, phosphopep, sample, quant
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5073 FROM contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5074 WHERE contrast = ", contrast, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5075 ORDER BY phosphopep, level, sample
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5076 "),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5077 connection = db
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5078 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5079 contrast_cast <- reshape2::dcast(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5080 data = contrast_df,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5081 formula = phosphopep ~ sample,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5082 value.var = "quant"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5083 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5084 contrast_cast_ncol <- ncol(contrast_cast)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5085 contrast_cast_data <- contrast_cast[, 2:contrast_cast_ncol]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5086 contrast_cast_samples <- colnames(contrast_cast_data)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5087
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5088 # - order grouping_factor by order of sample columns of contrast_cast_data
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5089 grouping_factor <- sqldf::sqldf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5090 x = paste0("
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5091 SELECT sample, level
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5092 FROM contrast_ppep_smpl_qnlt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5093 WHERE contrast = ", contrast, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5094 ORDER BY phosphopep, level, sample
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5095 LIMIT ", contrast_cast_ncol - 1
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5096 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5097 connection = db
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5098 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5099 rownames(grouping_factor) <- grouping_factor$sample
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5100 grouping_factor <- grouping_factor[, "level", drop = FALSE]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5101
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5102 # - run the two-level (one-way) test
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5103 p_value_data_contrast_ps <-
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5104 row_apply(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5105 x = contrast_cast_data,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5106 fun = anova_func,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5107 grouping_factor =
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5108 as.factor(grouping_factor$level), # anova_func arg2
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5109 one_way_f = one_way_two_categories, # anova_func arg3
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5110 simplify = TRUE # TRUE is the default for simplify
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5111 )
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5112
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5113 if (!is.null(p_value_data_contrast_ps)) {
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5114 contrast_data_adj_p_values <-
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5115 p.adjust(
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5116 p = p_value_data_contrast_ps,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5117 method = "fdr",
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5118 n = length(p_value_data_contrast_ps) # this is the default, length(p)
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5119 )
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5120
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5121 # - compute the fold-change
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5122 contrast_p_df <-
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5123 data.frame(
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5124 contrast = contrast,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5125 phosphopep = contrast_cast$phosphopep,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5126 p_value_raw = p_value_data_contrast_ps,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5127 p_value_adj = contrast_data_adj_p_values
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5128 )
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5129 db_write_table_overwrite <- (contrast < 2)
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5130 db_write_table_append <- !db_write_table_overwrite
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5131 RSQLite::dbWriteTable(
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5132 conn = db,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5133 name = "contrast_ppep_p_val",
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5134 value = contrast_p_df,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5135 append = db_write_table_append
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5136 )
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5137 # Create UK for insert
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5138 ddl_exec(db, "
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5139 CREATE UNIQUE INDEX IF NOT EXISTS contrast_ppep_p_val__uk__idx
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5140 ON contrast_ppep_p_val(phosphopep, contrast);
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5141 "
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5142 )
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5143 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5144 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5145 # Perhaps this could be done more elegantly using unique keys
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5146 # or creating the tables before saving data to them, but this
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5147 # is fast and, if the database exists on disk rather than in
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5148 # memory, it doesn't stress memory.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5149 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5150 CREATE TEMP table contrast_log2_fc
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5151 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5152 SELECT *
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5153 FROM v_contrast_log2_fc
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5154 ORDER BY contrast, phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5155 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5156 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5157 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5158 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5159 CREATE TEMP table ppep_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5160 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5161 SELECT p_value_raw,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5162 p_value_adj,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5163 contrast AS p_val_contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5164 phosphopep AS p_val_ppep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5165 FROM contrast_ppep_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5166 ORDER BY contrast, phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5167 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5168 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5169 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5170 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5171 DROP TABLE IF EXISTS contrast_log2_fc_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5172 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5173 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5174 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5175 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5176 CREATE TABLE contrast_log2_fc_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5177 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5178 SELECT a.*,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5179 b.p_value_raw,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5180 b.p_value_adj,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5181 b.p_val_contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5182 b.p_val_ppep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5183 FROM contrast_log2_fc a, ppep_p_val b
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5184 WHERE a.rowid = b.rowid
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5185 AND a.phosphopep = b.p_val_ppep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5186 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5187 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5188 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5189 # Create UK
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5190 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5191 CREATE UNIQUE INDEX IF NOT EXISTS contrast_log2_fc_p_val__uk__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5192 ON contrast_log2_fc_p_val(phosphopep, contrast);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5193 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5194 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5195 # Create indices for future queries
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5196 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5197 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__contrast__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5198 ON contrast_log2_fc_p_val(contrast);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5199 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5200 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5201 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5202 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__phosphopep__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5203 ON contrast_log2_fc_p_val(phosphopep);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5204 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5205 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5206 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5207 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__p_value_raw__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5208 ON contrast_log2_fc_p_val(p_value_raw);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5209 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5210 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5211 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5212 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__p_value_adj__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5213 ON contrast_log2_fc_p_val(p_value_adj);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5214 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5215 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5216 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5217 DROP VIEW IF EXISTS v_contrast_log2_fc_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5218 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5219 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5220 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5221 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5222 CREATE VIEW v_contrast_log2_fc_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5223 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5224 SELECT contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5225 a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5226 a_samples,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5227 b_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5228 b_samples,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5229 a_quant,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5230 b_quant,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5231 fc_description,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5232 log2_fc,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5233 p_value_raw,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5234 p_value_adj,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5235 phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5236 FROM contrast_log2_fc_p_val
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5237 ORDER BY contrast, phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5238 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5239 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5240 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5241 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5242 DROP TABLE IF EXISTS kseaapp_metadata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5243 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5244 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5245 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5246 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5247 CREATE TABLE kseaapp_metadata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5248 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5249 WITH extended(deppep, ppep, gene_name, uniprot_id, phosphoresidue) AS (
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5250 SELECT DISTINCT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5251 deppep.seq,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5252 ppep.seq,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5253 GeneName||';',
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5254 UniProtID||';',
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5255 PhosphoResidue||';'
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5256 FROM
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5257 ppep, deppep, mrgfltr_metadata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5258 WHERE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5259 mrgfltr_metadata.ppep_id = ppep.id
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5260 AND
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5261 ppep.deppep_id = deppep.id
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5262 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5263 SELECT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5264 ppep AS `ppep`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5265 SUBSTR(uniprot_id, 1, INSTR(uniprot_id,';') - 1 ) AS `Protein`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5266 SUBSTR(gene_name, 1, INSTR(gene_name,';') - 1 ) AS `Gene`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5267 deppep AS `Peptide`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5268 REPLACE(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5269 REPLACE(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5270 SUBSTR(phosphoresidue, 1, INSTR(phosphoresidue,';') - 1 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5271 'p',
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5272 ''
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5273 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5274 ', ',
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5275 ';'
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5276 ) AS `Residue.Both`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5277 FROM extended
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5278 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5279 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5280 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5281 # Create indexes for join
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5282 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5283 CREATE INDEX IF NOT EXISTS kseaapp_metadata__ppep__idx
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5284 ON kseaapp_metadata(ppep);
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5285 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5286 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5287 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5288 DROP VIEW IF EXISTS v_kseaapp_contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5289 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5290 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5291 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5292 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5293 CREATE VIEW v_kseaapp_contrast
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5294 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5295 SELECT a.*, b.Protein, b.Gene, b.Peptide, b.`Residue.Both`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5296 FROM v_contrast_log2_fc_p_val a, kseaapp_metadata b
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5297 WHERE b.ppep = a.phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5298 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5299 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5300 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5301 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5302 DROP VIEW IF EXISTS v_kseaapp_input
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5303 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5304 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5305 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5306 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5307 CREATE VIEW v_kseaapp_input
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5308 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5309 SELECT v.contrast,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5310 v.phosphopep,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5311 m.`Protein`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5312 m.`Gene`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5313 m.`Peptide`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5314 m.`Residue.Both`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5315 v.p_value_raw AS `p`,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5316 v.log2_fc AS `FC`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5317 FROM kseaapp_metadata AS m,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5318 v_contrast_log2_fc_p_val AS v
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5319 WHERE m.ppep = v.phosphopep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5320 AND NOT m.`Gene` = 'No_Gene_Name'
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5321 AND NOT v.log2_fc = 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5322 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5323 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5324 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5325 # We are done with DDL and insertion
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5326 RSQLite::dbDisconnect(db)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5327 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5328 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5329
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5330 ```{r echo = FALSE, results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5331 cat("\\newpage\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5332 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5333
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5334 # KSEA Analysis Summaries
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5335
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5336 Results of Kinase-Substrate Enrichment Analysis are presented here, if the substrates for any kinases are relatively enriched. Enrichments are found by the CRAN `KSEAapp` package:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5337
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5338 - The package is available on CRAN, at https:/cran.r-project.org/package=KSEAapp
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5339 - The method used is described in Casado et al. (2013) [doi:10.1126/scisignal.2003573](https:/doi.org/10.1126/scisignal.2003573) and Wiredja et al (2017) [doi:10.1093/bioinformatics/btx415](https:/doi.org/10.1093/bioinformatics/btx415).
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5340 - An online alternative (supporting only analysis of human data) is available at [https:/casecpb.shinyapps.io/ksea/](https:/casecpb.shinyapps.io/ksea/).
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5341
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5342 For each kinase, $i$, and each two-way contrast of treatments, $j$, an enrichment $z$-score is computed as:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5343
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5344 $$
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5345 \text{kinase enrichment }z\text{-score}_{j,i} = \frac{(\overline{`r sfc`}_{j,i} - \overline{`r pfc`}_j)\sqrt{m_{j,i}}}{\delta_j}
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5346 $$
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5347
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5348 and fold-enrichment is computed as:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5349
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5350 $$
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5351 \text{Enrichment}_{j,i} = \frac{\overline{`r sfc`}_{j,i}}{\overline{`r pfc`}_j}
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5352 $$
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5353
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5354 where:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5355
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5356 - $\overline{`r sfc`}_{j,i}$ is the mean `r pfc_txt` in intensities of known substrates of the kinase $i$ in contrast $j$,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5357 - $\overline{`r pfc`}_j$ is the mean `r pfc_txt` of all phosphosites identified in contrast $j$, and
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5358 - $m_{j,i}$ is the total number of phosphosite substrates of kinase $i$ identified in contrast $j$,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5359 - $\delta_j$ is the standard deviation of the $\log_2 (\text{fold-change})$ for contrast $j$ across all phosphosites in the dataset.
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5360 - Note that the absolute value of fold-change is used so that both increased and decreased substrates of a kinase will contribute to its enrichment score.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5361
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5362 $\text{FDR}_{j,i}$ is the False Discovery Rate corrected kinase enrichment score.
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5363
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5364 Color intensity in heatmaps reflects magnitude of $z$-score for enrichment of respective kinase in respective contrast; hue reflects the sign of the $z$-score (blue, negative; red, positive).
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5365
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5366 Asterisks in heatmaps reflect enrichments that are significant at `r ksea_cutoff_statistic` < `r ksea_cutoff_threshold`.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5367
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5368 - Kinase names are generally as presented at Phospho.ELM [http://phospho.elm.eu.org/kinases.html](http://phospho.elm.eu.org/kinases.html) (when available), although Phospho.ELM data are not yet incorporated into this analysis.
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5369 - Kinase names having the suffix '(HPRD)' are as presented at [http://hprd.org/serine_motifs](http://hprd.org/serine_motifs) and [http://hprd.org/tyrosine_motifs](http://hprd.org/tyrosine_motifs) and are as originally reported in the Amanchy et al., 2007 (doi: [10.1038/nbt0307-285](https://doi.org/10.1038/nbt0307-285)).
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5370 - Kinase-substrate data were also taken from [http://networkin.science/download.shtml](http://networkin.science/download.shtml) and from PhosphoSitePlus [https://www.phosphosite.org/staticDownloads](https://www.phosphosite.org/staticDownloads).
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5371
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5372 For each enriched kinase, a heatmap showing the intensities is presented for up to `r g_intensity_hm_rows` substrates, i.e., those substrates having the highest"quality".
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5373
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5374 Where possible, a heatmap of the correlations among these the selected substrates is also presented; if correlations cannot be computed (because of too many missing values), then the covariances are heatmapped for substrates having a variance greater than 1.
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5375
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5376 ```{r ksea, echo = FALSE, fig.dim = c(12, 14.5), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5377 cat("\\clearpage\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5378
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5379 db <- RSQLite::dbConnect(RSQLite::SQLite(), ksea_app_prep_db)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5380
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5381 # -- eliminate the table that's about to be defined
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5382 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5383 DROP TABLE IF EXISTS site_metadata;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5384 ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5385
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5386 # -- define the site_metadata table
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5387 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5388 CREATE TABLE site_metadata(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5389 id INTEGER PRIMARY KEY
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5390 , site_type_id INTEGER REFERENCES site_type(id)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5391 , full TEXT UNIQUE ON CONFLICT IGNORE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5392 , abbrev TEXT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5393 , pattern TEXT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5394 , motif TEXT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5395 );
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5396 ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5397
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5398 # -- populate the table with initial values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5399 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5400 INSERT INTO site_metadata(full, abbrev, site_type_id)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5401 SELECT DISTINCT kinase_map, kinase_map, site_type_id
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5402 FROM ppep_gene_site
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5403 ORDER BY kinase_map;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5404 ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5405
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5406 # -- drop bogus KSData view if exists
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5407 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5408 DROP VIEW IF EXISTS ks_data_v;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5409 ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5410
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5411 # -- create view to serve as an impostor for KSEAapp::KSData
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5412 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5413 CREATE VIEW IF NOT EXISTS ks_data_v
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5414 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5415 SELECT
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5416 'NA' AS KINASE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5417 'NA' AS KIN_ACC_ID,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5418 kinase_map AS GENE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5419 'NA' AS KIN_ORGANISM,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5420 'NA' AS SUBSTRATE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5421 0 AS SUB_GENE_ID,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5422 'NA' AS SUB_ACC_ID,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5423 gene_names AS SUB_GENE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5424 'NA' AS SUB_ORGANISM,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5425 phospho_peptide AS SUB_MOD_RSD,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5426 0 AS SITE_GROUP_ID,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5427 'NA' AS 'SITE_7AA',
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5428 2 AS networkin_score,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5429 type_name AS Source
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5430 FROM ppep_gene_site_view;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5431 ")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5432
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5433 contrast_metadata_df <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5434 sqldf::sqldf("select * from contrast_lvl_lvl_metadata", connection = db)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5435 rslt <- new_env()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5436 rslt$score_list <- list()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5437 rslt$name_list <- list()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5438 rslt$longname_list <- list()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5439
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5440 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5441 DROP TABLE IF EXISTS contrast_ksea_scores;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5442 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5443 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5444
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5445 next_index <- 0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5446 err_na_subscr_df_const <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5447 "missing values are not allowed in subscripted assignments of data frames"
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5448
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5449 for (i_cntrst in seq_len(nrow(contrast_metadata_df))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5450 cntrst_a_level <- contrast_metadata_df[i_cntrst, "a_level"]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5451 cntrst_b_level <- contrast_metadata_df[i_cntrst, "b_level"]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5452 cntrst_fold_change <- contrast_metadata_df[i_cntrst, 6]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5453 contrast_label <- sprintf("%s -> %s", cntrst_b_level, cntrst_a_level)
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5454 contrast_longlabel <- (
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5455 sprintf(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5456 "Class %s -> Class %s",
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5457 contrast_metadata_df[i_cntrst, "b_level"],
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5458 contrast_metadata_df[i_cntrst, "a_level"]
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5459 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5460 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5461 kseaapp_input <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5462 sqldf::sqldf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5463 x = sprintf("
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5464 SELECT `Protein`, `Gene`, `Peptide`, phosphopep AS `Residue.Both`, `p`, `FC`
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5465 FROM v_kseaapp_input
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5466 WHERE contrast = %d
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5467 ",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5468 i_cntrst
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5469 ),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5470 connection = db
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5471 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5472
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5473 pseudo_ksdata <- dbReadTable(db, "ks_data_v")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5474
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5475 # This hack is because SQL table has the log2-transformed values
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5476 kseaapp_input[, "FC"] <- 2 ** kseaapp_input[, "FC", drop = TRUE]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5477 main_title <- (
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5478 sprintf(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5479 "Change from treatment %s to treatment %s",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5480 contrast_metadata_df[i_cntrst, "b_level"],
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5481 contrast_metadata_df[i_cntrst, "a_level"]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5482 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5483 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5484 sub_title <- contrast_longlabel
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5485 tryCatch(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5486 expr = {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5487 ksea_scores_rslt <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5488 ksea_scores(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5489 ksdata = pseudo_ksdata,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5490 px = kseaapp_input,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5491 networkin = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5492 networkin_cutoff = 2,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5493 minimum_substrate_count = ksea_min_substrate_count
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5494 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5495
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5496 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5497 ksea_scores_rslt <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5498 ksea_scores_rslt[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5499 ksea_scores_rslt$m >= ksea_min_substrate_count,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5500 ,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5501 drop = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5502 ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5503 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5504
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5505 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5506 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5507 x = ksea_scores_rslt,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5508 tabstops = c(0.8, 0.8, 0.8, 0.8, 0.8, 0.8),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5509 caption = paste("KSEA scores for contrast ",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5510 cntrst_b_level, "to", cntrst_a_level),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5511 use_subsubsection_header = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5512 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5513 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5514
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5515 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5516 if (print_nb_messages) nbe("Output contents of `ksea_scores_rslt` table\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5517 cat_variable(ksea_scores_rslt)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5518 cat("\n\\clearpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5519 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5520
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5521 if (0 < sum(!is.nan(ksea_scores_rslt$FDR))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5522 next_index <- 1 + next_index
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5523 rslt$score_list[[next_index]] <- ksea_scores_rslt
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5524 rslt$name_list[[next_index]] <- contrast_label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5525 rslt$longname_list[[next_index]] <- contrast_longlabel
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5526 ksea_low_fdr_print(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5527 rslt = rslt,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5528 i_cntrst = i_cntrst,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5529 i = next_index,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5530 a_level = cntrst_a_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5531 b_level = cntrst_b_level,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5532 fold_change = cntrst_fold_change,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5533 caption = contrast_longlabel
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5534 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5535 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5536 },
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5537 error = function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5538 str(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5539 cat_margins()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5540 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5541 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5542 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5543
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5544 plotted_kinases <- NULL
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5545 if (g_can_run_ksea && length(rslt$score_list) > 1) {
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5546 for (i in seq_len(length(ksea_heatmap_titles))) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5547 hdr <- ksea_heatmap_titles[[i]]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5548 which_kinases <- i
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5549
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5550 cat("\\clearpage\n\\begin{center}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5551 if (i == const_ksea_astrsk_kinases) {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5552 cat(subsection_header(hdr))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5553 } else {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5554 cat(subsection_header(hdr))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5555 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5556 cat("\\end{center}\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5557
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5558 plotted_kinases <- ksea_heatmap(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5559 # the data frame outputs from the KSEA.Scores() function, in list format
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5560 score_list = rslt$score_list,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5561 # a character vector of all the sample names for heatmap annotation:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5562 # - the names must be in the same order as the data in score_list
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5563 # - please avoid long names, as they may get cropped in the final image
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5564 sample_labels = rslt$name_list,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5565 # character string of either "p.value" or "FDR" indicating the data column
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5566 # to use for marking statistically significant scores
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5567 stats = c("p.value", "FDR")[2],
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5568 # a numeric value between 0 and infinity indicating the min. number of
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5569 # substrates a kinase must have to be included in the heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5570 m_cutoff = 1,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5571 # a numeric value between 0 and 1 indicating the p-value/FDR cutoff
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5572 # for indicating significant kinases in the heatmap
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5573 p_cutoff = params$kseaCutoffThreshold,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5574 # a binary input of TRUE or FALSE, indicating whether or not to perform
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5575 # hierarchical clustering of the sample columns
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5576 sample_cluster = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5577 # a binary input of TRUE or FALSE, indicating whether or not to export
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5578 # the heatmap as a .png image into the working directory
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5579 export = FALSE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5580 # additional arguments to gplots::heatmap.2, such as:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5581 # - main: main title of plot
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5582 # - xlab: x-axis label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5583 # - ylab: y-axis label
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5584 xlab = "Contrast",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5585 ylab = "Kinase",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5586 # print which kinases:
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5587 # - 1 : all kinases
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5588 # - 2 : significant kinases
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5589 # - 3 : non-significant kinases
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5590 which_kinases = which_kinases,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5591 margins = c(7, 15)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5592 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5593 if (!is.null(plotted_kinases)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5594 cat("\\begin{center}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5595 if (which_kinases != const_ksea_nonastrsk_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5596 cat("Asterisks reflect significance.\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5597 cat("\\end{center}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5598 }
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5599 } # end for (i in ...
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5600 } # end if (length ...
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5601 ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5602
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5603 ```{r kseabar_calc, echo = FALSE, fig.dim = c(9.5, 6), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5604 ksea_prints <- list()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5605 ksea_barplots <- list()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5606 for (i_cntrst in seq_len(length(rslt$score_list))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5607 next_index <- i_cntrst
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5608 cntrst_a_level <- contrast_metadata_df[i_cntrst, "a_level"]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5609 cntrst_b_level <- contrast_metadata_df[i_cntrst, "b_level"]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5610 cntrst_fold_change <- contrast_metadata_df[i_cntrst, 6]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5611 contrast_label <- sprintf("%s -> %s", cntrst_b_level, cntrst_a_level)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5612 contrast_longlabel <- (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5613 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5614 "Class %s -> Class %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5615 contrast_metadata_df[i_cntrst, "b_level"],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5616 contrast_metadata_df[i_cntrst, "a_level"]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5617 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5618 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5619 main_title <- (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5620 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5621 "Change from treatment %s to treatment %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5622 contrast_metadata_df[i_cntrst, "b_level"],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5623 contrast_metadata_df[i_cntrst, "a_level"]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5624 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5625 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5626 sub_title <- contrast_longlabel
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5627 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5628 expr = {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5629 ksea_scores_rslt <- rslt$score_list[[next_index]]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5630 if (print_nb_messages) nbe(see_variable(ksea_scores_rslt)) #ACE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5631
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5632 if (0 < sum(!is.nan(ksea_scores_rslt$FDR))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5633 sink(deferred <- file())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5634 ksea_low_fdr_print(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5635 rslt = rslt,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5636 i_cntrst = i_cntrst,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5637 i = next_index,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5638 a_level = cntrst_a_level,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5639 b_level = cntrst_b_level,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5640 fold_change = cntrst_fold_change,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5641 caption = contrast_longlabel,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5642 write_db = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5643 anchor = const_table_anchor_t
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5644 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5645 cat("\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5646 sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5647 lines <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5648 paste(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5649 readLines(deferred, warn = FALSE),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5650 collapse = "\n"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5651 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5652 close(deferred)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5653 sq_put(ksea_prints, lines)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5654 sink(stderr())
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5655 cat("\n---\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5656 cat_variable(ksea_prints)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5657 barplot_closure <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5658 ksea_low_fdr_barplot_factory(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5659 rslt = rslt,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5660 i_cntrst = i_cntrst,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5661 i = next_index,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5662 a_level = cntrst_a_level,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5663 b_level = cntrst_b_level,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5664 fold_change = cntrst_fold_change,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5665 caption = contrast_longlabel
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5666 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5667 if (rlang::is_closure(barplot_closure))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5668 sq_put(ksea_barplots, barplot_closure)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5669 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5670 sq_put(ksea_barplots, no_op)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5671 str(ksea_barplots)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5672 cat("\n...\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5673 sink()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5674 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5675 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5676 error = function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5677 str(e)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5678 cat_margins()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5679 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5680 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5681 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5682 ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5683
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5684 ```{r phosphoelm_kinase_upid_desc, echo = FALSE, fig.dim = c(12, 13.7), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5685
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5686 have_kinase_descriptions <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5687 if (!is.null(bzip2df(kinase_uprt_desc_lut, kinase_uprt_desc_lut_bz2)) &&
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5688 !is.null(bzip2df(kinase_name_uprt_lut, kinase_name_uprt_lut_bz2))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5689 ) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5690 rownames(kinase_uprt_desc_lut) <- kinase_uprt_desc_lut$UniProtID
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5691 kinase_name_to_desc_uprt <- function(s) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5692 rslt <- NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5693 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5694 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5695 which_rows <- eval(s == kinase_name_uprt_lut$kinase)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5696 kinase_uprtid <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5697 kinase_name_uprt_lut[which_rows, 2]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5698 # filter for first _HUMAN match if any
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5699 grepl_human <- grepl("_HUMAN$", kinase_uprtid)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5700 if (0 < sum(grepl_human))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5701 kinase_uprtid <- kinase_uprtid[grepl_human]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5702 # filter for first match if any
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5703 if (0 < length(kinase_uprtid)) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5704 kinase_uprtid <- kinase_uprtid[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5705 kinase_desc <- kinase_uprt_desc_lut[kinase_uprtid, 2]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5706 if (!is.na(kinase_desc))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5707 rslt <- c(kinase_desc, kinase_uprtid)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5708 else
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5709 rslt <- c(kinase_desc, "")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5710 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5711 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5712 warning = str
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5713 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5714 rslt
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5715 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5716 TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5717 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5718 kinase_name_to_desc_uprt <- function(s) NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5719 FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5720 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5721 ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5722
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5723 ```{r write_params, echo = FALSE, results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5724 # perhaps this should be moved into the functions section, eventually ...
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5725 write_params <- function(db) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5726 # write parameters to report
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5727
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5728 # write parameters to SQLite output
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5729
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5730 mqppep_anova_script_param_df <- data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5731 script = "mqppep_anova_script.Rmd",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5732 parameter = names(param_unlist),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5733 value = param_unlist
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5734 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5735 ddl_exec(db, "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5736 DROP TABLE IF EXISTS script_parameter;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5737 "
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5738 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5739 ddl_exec(db, "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5740 CREATE TABLE IF NOT EXISTS script_parameter(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5741 script TEXT,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5742 parameter TEXT,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5743 value ANY,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5744 UNIQUE (script, parameter) ON CONFLICT REPLACE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5745 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5746 ;
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5747 "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5748 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5749 RSQLite::dbWriteTable(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5750 conn = db,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5751 name = "script_parameter",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5752 value = mqppep_anova_script_param_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5753 append = TRUE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5754 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5755
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5756 loaded_packages_df <- sessioninfo::package_info("loaded")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5757 loaded_packages_df[, "library"] <- as.character(loaded_packages_df$library)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5758 loaded_packages_df <- data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5759 package = loaded_packages_df$package,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5760 version = loaded_packages_df$loadedversion,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5761 date = loaded_packages_df$date
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5762 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5763 #ACE cat("\\clearpage\n\\section{R package versions}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5764 #ACE data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5765 #ACE x = loaded_packages_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5766 #ACE tabstops = c(2.5, 1.25),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5767 #ACE caption = "R package versions"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5768 #ACE )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5769 cat("\\clearpage\n\\section{Input parameter settings}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5770 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5771 x = param_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5772 tabstops = c(1.75),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5773 underscore_whack = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5774 caption = "Input parameters",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5775 verbatim = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5776 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5777 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5778
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5779 if (!have_kinase_descriptions) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5780 write_params(db)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5781 # We are done with output
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5782 RSQLite::dbDisconnect(db)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5783 param_df_exit()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5784 knitr::knit_exit()
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5785 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5786 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5787
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5788 ```{r kseabar, echo = FALSE, fig.dim = c(9.5, 12.3), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5789 if (have_kinase_descriptions) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5790 my_section_header <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5791 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5792 "inases whose KSEA %s < %s\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5793 ksea_cutoff_statistic,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5794 signif(ksea_cutoff_threshold, 2)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5795 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5796
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5797 # Use enriched kinases to find enriched kinase-substrate pairs
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5798 enriched_kinases <- data.frame(kinase = ls(ksea_asterisk_hash))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5799
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5800 enriched_kinase_descs <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5801 Reduce(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5802 f = function(l, r) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5803 lkup <- kinase_name_to_desc_uprt(r)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5804 if (is.null(lkup)) l
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5805 else r2 <- rbind(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5806 l,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5807 data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5808 kinase = r,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5809 uniprot_id = lkup[2],
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5810 description = lkup[1]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5811 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5812 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5813 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5814 x = enriched_kinases$kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5815 init = NULL
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5816 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5817
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5818 if (length(enriched_kinase_descs) > 0 && nrow(enriched_kinase_descs) > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5819 cat("\n\\clearpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5820 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5821 x = enriched_kinase_descs,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5822 tabstops = c(0.9, 1.3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5823 headings = c("Kinase", "UniProt ID", "Description"),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5824 caption = paste0("Descriptions of k", my_section_header)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5825 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5826 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5827
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5828 if (FALSE) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5829 cat_variable(sqldf("SELECT kinase FROM enriched_kinases"))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5830 cat_variable(sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5831 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5832 FROM pseudo_ksdata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5833 WHERE gene IN (SELECT kinase FROM enriched_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5834 "))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5835 data_frame_table_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5836 x = sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5837 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5838 FROM pseudo_ksdata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5839 WHERE gene IN (SELECT kinase FROM enriched_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5840 "),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5841 justification = "l l l",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5842 centered = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5843 caption = "substrates of enriched kinases",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5844 anchor = c(const_table_anchor_p, const_table_anchor_t),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5845 underscore_whack = TRUE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5846 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5847 data_frame_table_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5848 x = sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5849 SELECT
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5850 gene AS kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5851 ppep,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5852 sub_gene,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5853 '('||group_concat(gene||'-'||sub_gene)||') '||ppep AS label,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5854 fdr_adjusted_anova_p,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5855 quality,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5856 min_group_obs_count
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5857 FROM (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5858 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5859 FROM pseudo_ksdata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5860 WHERE gene IN (SELECT kinase FROM enriched_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5861 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5862 p_value_data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5863 WHERE ppep = phosphopeptide
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5864 GROUP BY kinase, ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5865 ORDER BY kinase, ppep, p_value_data.quality DESC
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5866 "),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5867 justification = "l l l l l l l",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5868 centered = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5869 caption = "labeled substrates of enriched kinases",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5870 anchor = c(const_table_anchor_p, const_table_anchor_t),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5871 underscore_whack = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5872 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5873 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5874 all_enriched_substrates <- sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5875 SELECT
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5876 gene AS kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5877 ppep,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5878 sub_gene,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5879 '('||group_concat(gene||'-'||sub_gene)||') '||ppep AS label,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5880 fdr_adjusted_anova_p,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5881 quality,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5882 min_group_obs_count
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5883 FROM (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5884 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5885 FROM pseudo_ksdata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5886 WHERE gene IN (SELECT kinase FROM enriched_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5887 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5888 p_value_data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5889 WHERE ppep = phosphopeptide
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5890 GROUP BY kinase, ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5891 ORDER BY kinase, ppep, p_value_data.quality DESC
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5892 ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5893
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5894 all_enriched_substrates <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5895 all_enriched_substrates[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5896 all_enriched_substrates$quality >= params$minQuality,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5897 ,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5898 drop = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5899 ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5900
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5901 all_enriched_substrates$sub_gene <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5902 sub(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5903 " ///.*",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5904 " ...",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5905 all_enriched_substrates$sub_gene
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5906 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5907
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5908 all_enriched_substrates$label <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5909 with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5910 all_enriched_substrates,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5911 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5912 "(%s-%s) %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5913 kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5914 trunc_subgene(sub_gene),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5915 ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5916 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5917 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5918
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5919 # this global is set to TRUE by cat_enriched_heading immediately below
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5920 g_neednewpage <- FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5921
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5922 # helper used to label per-kinase substrate enrichment figure
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5923 cat_enriched_heading <- function(m, cut_args) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5924 cutoff <- cut_args$cutoff
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5925 kinase <- cut_args$kinase
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5926 if (g_neednewpage) cat("\\newpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5927 g_neednewpage <- TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5928 if (nrow(m) > g_intensity_hm_rows) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5929 cat(subsection_header(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5930 sprintf(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5931 "Highest-quality %d (of %d) enriched %s-substrates",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5932 g_intensity_hm_rows,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5933 nrow(m),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5934 kinase
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5935 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5936 ))
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5937 } else {
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5938 if (nrow(m) == 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5939 return(FALSE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5940 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5941 nrow_m <- nrow(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5942 cat(subsection_header(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5943 sprintf(
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5944 "%d enriched %s-substrate%s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5945 nrow_m,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5946 kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5947 if (nrow_m > 1) "s" else ""
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5948 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5949 ))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5950 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5951 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5952 cat("\n\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5953 cat("\n\n\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5954 return(TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5955 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5956
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5957 # --------------------------------
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5958 # hack begin - show all substrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5959 enriched_substrates <- all_enriched_substrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5960 # add "FALSE &&" to prevent listing of substrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5961 if (show_enriched_substrates && nrow(enriched_substrates) > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5962 short_row_names <- sub(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5963 "$FAILED_MATCH_GENE_NAME",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5964 "not_found",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5965 enriched_substrates$sub_gene,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5966 fixed = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5967 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5968
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5969 if (print_nb_messages) nbe(see_variable(enriched_substrates))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5970 substrates_df <- with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5971 enriched_substrates,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5972 data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5973 kinase = kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5974 substrate = sub(" ///*", "...", short_row_names),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5975 anova_p_value = signif(fdr_adjusted_anova_p, 2),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5976 min_group_obs_count = signif(min_group_obs_count, 0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5977 quality = signif(quality, 3),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5978 sequence = trunc_n(30)(ppep)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5979 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5980 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5981
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5982 substrates_df <- substrates_df[
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5983 with(substrates_df, order(kinase, -quality)),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5984 ,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5985 drop = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5986 ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5987
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5988 if (print_nb_messages) nbe(see_variable(substrates_df))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5989 if (nrow(substrates_df) < 1)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5990 substrates_df$sequence <- c()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5991 if (print_nb_messages) nbe(see_variable(substrates_df))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5992 names(substrates_df) <- headers_2nd_line <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5993 c("Kinase", "Substrate", "p-value", "per group)", "quality", "Sequence")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5994 headers_1st_line <- c("", "", "ANOVA", "min(values", "", "")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5995 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5996 x = substrates_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5997 tabstops = c(1.2, 0.8, 0.5, 0.65, 0.5),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5998 headings = c(headers_1st_line, headers_2nd_line),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5999 caption = "Details for all enriched substrates of enriched kinases"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6000 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6001 rm(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6002 enriched_substrates,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6003 substrates_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6004 short_row_names,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6005 headers_1st_line,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6006 headers_2nd_line
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6007 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6008 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6009 cat("\\clearpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6010 # hack end - show all substrates
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6011 # --------------------------------
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6012
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6013 # print deferred tables and graphs for kinases from contrasts
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6014 for (i_cntrst in seq_len(length(ksea_prints))) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6015 #latex_samepage({
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6016 cat(ksea_prints[[i_cntrst]])
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6017 cat("\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6018 ksea_barplots[[i_cntrst]]()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6019 cat("\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6020 cat("\\clearpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6021 #})
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6022 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6023
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6024 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6025 ```
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6026
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6027 ```{r enriched, echo = FALSE, fig.dim = c(12, 13.7), results = 'asis'}
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6028 if (g_can_run_ksea) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6029 g_did_enriched_header <- FALSE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6030 for (kinase_name in sort(enriched_kinases$kinase)) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6031 enriched_substrates <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6032 all_enriched_substrates[
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6033 all_enriched_substrates$kinase == kinase_name,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6034 ,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6035 drop = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6036 ]
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6037 ten_trunc_ppep <- trunc_enriched_substrate(enriched_substrates$ppep)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6038 enriched_substrates$label <- with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6039 enriched_substrates,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6040 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6041 "(%s) %s",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6042 make.names(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6043 sub("$FAILED_MATCH_GENE_NAME", "not_found", sub_gene, fixed = TRUE),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6044 unique = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6045 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6046 ten_trunc_ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6047 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6048 )
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6049 # Get the intensity values for the heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6050 enriched_intensities <-
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6051 as.matrix(unimputed_quant_data_log[enriched_substrates$ppep, , drop = FALSE])
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6052
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6053 # Remove rows having too many NA values to be relevant
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6054 good_rows <- (rowSums(enriched_intensities, na.rm = TRUE) != 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6055 #ACE nbe(see_variable(good_rows), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6056 enriched_substrates <- enriched_substrates[good_rows, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6057 enriched_intensities <- enriched_intensities[good_rows, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6058
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6059 # Rename the rows with the display-name for the heatmap
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6060 short_row_names <- sub(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6061 "$FAILED_MATCH_GENE_NAME",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6062 "not_found",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6063 enriched_substrates$sub_gene,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6064 fixed = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6065 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6066 short_row_names <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6067 make.names(short_row_names, unique = TRUE)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6068 long_row_names <-
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6069 sapply(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6070 X = rownames(enriched_intensities),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6071 FUN = function(rn) {
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6072 enriched_substrates[enriched_substrates$ppep == rn, "label"]
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6073 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6074 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6075 rownames(enriched_intensities) <- long_row_names
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6076 # Format as matrix for heatmap
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6077 m <- as.matrix(enriched_intensities)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6078 rownames(m) <- trunc_enriched_substrate(rownames(m))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6079
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6080 #ACE nb("m with bad rows: ", see_variable(m), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6081 #ACE good_rows <- (rowSums(m, na.rm = TRUE) != 0)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6082 #ACE nb(see_variable(good_rows), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6083 #ACE m <- m[good_rows, , drop = FALSE]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6084 #ACE nb("m without(?) bad rows: ", see_variable(m), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6085 #ACE nb(see_variable(short_row_names), "\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6086 #ACE local_short_row_names <- short_row_names[good_rows]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6087 #ACE local_long_row_names <- long_row_names[good_rows]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6088 #ACE local_enriched_intensities <- enriched_intensities[local_long_row_names, ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6089
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6090 # Draw the heading and heatmap
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6091 nrow_m <- nrow(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6092 if (nrow_m > 0) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6093 if (!g_did_enriched_header) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6094 cat("\n\\clearpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6095 cat(section_header(paste0("K", my_section_header)))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6096 g_did_enriched_header <- TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6097 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6098 is_na_m <- is.na(m)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6099 cellnote_m <- is_na_m
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6100 cellnote_m[!is_na_m] <- ""
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6101 cellnote_m[is_na_m] <- "NA"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6102 cut_args <- new_env()
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6103 cut_args$cutoff <- cutoff
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6104 cut_args$kinase <- kinase_name
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6105 cut_args$statistic <- ksea_cutoff_statistic
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6106 cut_args$threshold <- ksea_cutoff_threshold
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6107 number_of_peptides_found <-
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6108 ppep_heatmap(
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6109 m = m,
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6110 cellnote = cellnote_m,
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6111 cutoff = cut_args,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6112 hm_heading_function = cat_enriched_heading,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6113 hm_main_title
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6114 = "Unnormalized (zero-imputed) intensities of enriched kinase-substrates",
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6115 suppress_row_dendrogram = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6116 master_cex = 0.35,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6117 sepcolor = "black",
2
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
6118 colsep = sample_colsep,
2336fbff8866 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
6119 row_scaling = "none"
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6120 )
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6121 if (number_of_peptides_found > 1) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6122
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6123 tryCatch(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6124 {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6125 rownames(m) <- short_row_names
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6126 cov_heatmap(m, nrow_m > g_intensity_hm_rows)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6127 },
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6128 error = function(e) {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6129 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6130 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6131 "ERROR: %s\n\\newline\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6132 mget("e")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6133 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6134 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6135 cat(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6136 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6137 "message: %s\n\\newline\n",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6138 e$message
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6139 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6140 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6141 cat_margins()
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6142 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6143 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6144 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6145 substrates_df <- with(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6146 enriched_substrates,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6147 data.frame(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6148 substrate = sub(" ///*", "...", short_row_names),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6149 sequence = trunc_long_ppep(ppep),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6150 anova_p_value = signif(fdr_adjusted_anova_p, 2),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6151 min_group_obs_count = signif(min_group_obs_count, 0),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6152 quality = signif(quality, 3)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6153 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6154 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6155 excess_substrates <- nrow(substrates_df) > g_intensity_hm_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6156 if (excess_substrates)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6157 substrates_df <- substrates_df[1:g_intensity_hm_rows, ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6158 names(substrates_df) <- headers_2nd_line <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6159 c("Substrate", "Sequence", "p-value", "per group)", "quality")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6160 headers_1st_line <- c("", "", "ANOVA", "min(values", "")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6161 if (1 < nrow(enriched_substrates))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6162 cat("\n\\newpage\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6163 cat(subsubsection_header(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6164 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6165 "Details for %s%s-substrates",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6166 if (excess_substrates)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6167 sprintf(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6168 "%s \"highest quality\" ",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6169 g_intensity_hm_rows
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6170 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6171 else "",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6172 kinase_name
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6173 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6174 ))
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6175 substrates_df <- substrates_df[order(-substrates_df$quality), ]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6176 data_frame_tabbing_latex(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6177 x = substrates_df,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6178 tabstops = c(0.8, 3.8, 0.6, 0.8),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6179 headings = c(headers_1st_line, headers_2nd_line)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6180 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6181 } else {
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6182 if (print_nb_messages) nbe(see_variable(nrow_m > 0), "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6183 }
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6184 if (print_nb_messages) nb("end kinase ", kinase_name, "\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6185 }
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6186
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6187 # Write output tabular files
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6188
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6189 # get kinase, ppep, concat(kinase) tuples for enriched kinases
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6190
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6191 if (print_nb_messages) nb("kinase_ppep_label <- ...\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6192 if (print_nb_messages) nbe("kinase_ppep_label <- ...\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6193 kinase_ppep_label <- sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6194 WITH
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6195 t(ppep, label) AS
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6196 (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6197 SELECT DISTINCT
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6198 SUB_MOD_RSD AS ppep,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6199 group_concat(gene, '; ') AS label
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6200 FROM pseudo_ksdata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6201 WHERE GENE IN (SELECT kinase FROM enriched_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6202 GROUP BY ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6203 ),
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6204 k(kinase, ppep_join) AS
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6205 (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6206 SELECT DISTINCT gene AS kinase, SUB_MOD_RSD AS ppep_join
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6207 FROM pseudo_ksdata
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6208 WHERE GENE IN (SELECT kinase FROM enriched_kinases)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6209 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6210 SELECT k.kinase, t.ppep, t.label
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6211 FROM t, k
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6212 WHERE t.ppep = k.ppep_join
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6213 ORDER BY k.kinase, t.ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6214 ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6215
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6216
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6217 # extract what we need from full_data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6218 impish <- cbind(rownames(quant_data_imp), quant_data_imp)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6219 colnames(impish)[1] <- "Phosphopeptide"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6220 data_table_imputed_sql <- "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6221 SELECT
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6222 f.*,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6223 k.label AS KSEA_enrichments,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6224 q.*
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6225 FROM
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6226 metadata_plus_p f
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6227 LEFT JOIN kinase_ppep_label k
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6228 ON f.Phosphopeptide = k.ppep,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6229 impish q
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6230 WHERE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6231 f.Phosphopeptide = q.Phosphopeptide
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6232 "
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6233 data_table_imputed <- sqldf(data_table_imputed_sql)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6234 # Zap the duplicated 'Phosphopeptide' column named 'ppep'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6235 data_table_imputed <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6236 data_table_imputed[, c(1:12, 14:ncol(data_table_imputed))]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6237
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6238 # Output imputed, un-normalized data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6239 if (print_nb_messages) nb("Output imputed, un-normalized data tabular file\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6240 if (print_nb_messages) nbe("Output imputed, un-normalized data tabular file\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6241 write.table(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6242 data_table_imputed
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6243 , file = imputed_data_filename
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6244 , sep = "\t"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6245 , col.names = TRUE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6246 , row.names = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6247 , quote = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6248 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6249
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6250
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6251 #output quantile normalized data
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6252 impish <- cbind(rownames(quant_data_imp_qn_log), quant_data_imp_qn_log)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6253 colnames(impish)[1] <- "Phosphopeptide"
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6254 data_table_imputed <- sqldf(data_table_imputed_sql)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6255 # Zap the duplicated 'Phosphopeptide' column named 'ppep'
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6256 data_table_imputed <-
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6257 data_table_imputed[, c(1:12, 14:ncol(data_table_imputed))]
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6258 if (print_nb_messages) nb("Output quantile normalized data tabular file\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6259 if (print_nb_messages) nbe("Output quantile normalized data tabular file\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6260 write.table(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6261 data_table_imputed,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6262 file = imp_qn_lt_data_filenm,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6263 sep = "\t",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6264 col.names = TRUE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6265 row.names = FALSE,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6266 quote = FALSE
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6267 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6268
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6269 ppep_kinase <- sqldf("
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6270 SELECT DISTINCT k.ppep, k.kinase
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6271 FROM (
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6272 SELECT DISTINCT gene AS kinase, SUB_MOD_RSD AS ppep
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6273 FROM pseudo_ksdata
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6274 WHERE GENE IN (SELECT kinase FROM enriched_kinases)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6275 ) k
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6276 ORDER BY k.ppep, k.kinase
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6277 ")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6278
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6279 RSQLite::dbWriteTable(
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6280 conn = db,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6281 name = "ksea_enriched_ks",
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6282 value = ppep_kinase,
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6283 append = FALSE
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6284 )
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6285 }
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6286
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6287 if (print_nb_messages) nb("RSQLite::dbWriteTable anova_signif\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6288
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6289 RSQLite::dbWriteTable(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6290 conn = db,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6291 name = "anova_signif",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6292 value = p_value_data,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6293 append = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6294 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6295
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6296 ddl_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6297 DROP VIEW IF EXISTS stats_metadata_v;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6298 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6299 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6300 dml_no_rows_exec(db, "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6301 CREATE VIEW stats_metadata_v
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6302 AS
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6303 SELECT DISTINCT m.*,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6304 p.raw_anova_p,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6305 p.fdr_adjusted_anova_p,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6306 kek.kinase AS ksea_enrichments
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6307 FROM
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6308 mrgfltr_metadata_view m
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6309 LEFT JOIN anova_signif p
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6310 ON m.phospho_peptide = p.phosphopeptide
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6311 LEFT JOIN ksea_enriched_ks kek
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6312 ON m.phospho_peptide = kek.ppep
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6313 ;
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6314 "
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6315 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6316
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6317 if (print_nb_messages) nb("Output contents of `stats_metadata_v` table to tabular file\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6318 if (print_nb_messages) nbe("Output contents of `stats_metadata_v` table to tabular file\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6319 write.table(
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6320 dbReadTable(db, "stats_metadata_v"),
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6321 file = anova_ksea_mtdt_file,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6322 sep = "\t",
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6323 col.names = TRUE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6324 row.names = FALSE,
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6325 quote = FALSE
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6326 )
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6327
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6328 cat("\n\\clearpage\n")
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6329
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6330 ```
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6331
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6332 # Data-processing summary flowchart
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6333
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6334 ![Flowchart showing ANOVA and KSEA data-processing steps](KSEA_impl_flowchart.pdf)
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6335
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6336 ```{r parmlist, echo = FALSE, fig.dim = c(9, 10), results = 'asis'}
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6337 cat("\\leavevmode\n\n\n")
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6338
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6339 write_params(db)
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6340 # We are done with output
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6341 RSQLite::dbDisconnect(db)
1
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6342
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6343 cat("\\clearpage\n\\section{R package versions}\n")
08678c931f5d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6344 utils::toLatex(utils::sessionInfo())
0
dbff53e6f75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6345 ```